1

I'm using the RxTx library over usbserial on a Linux distro. The RxTx lib seems to behave quite differently (in a bad way) than how it works over serial.

One of my biggest problems is that the RxTx SerialPortEvent.OUTPUT_BUFFER_EMPTY does not work on linux over usb serial.

How do I know when I should write to the stream? Any indicators I might have missed?

So far my experience with writing and reading concurrently have not been great. Does anyone know if I should lock the DATA_AVAILABLE handler from being invoked while I'm writing on the stream? Or RxTx accepts concurrent read/writes?

2 Answers 2

5

(perhaps slightly off-topic, but here goes)

I'm not familiar with that particular library, but I can assure you from dire experience (I work in the security systems (as in: hardware security devices) business, where RS-232 is heavily used) that not all USB-serial converters are born equal. Many such devices so not properly emulate all RS-232 lines, and many don't even handle any comms without flow control. Before blaming the library, try to confirm that the hardware actually does what it's supposed to do.

Without wanting to endorse a particular product or brand, the best (as in: least buggy) USB-serial converter I have come across in years is the USA-19HS.

3
  • Keyspan got bought out by Tripp-Lite who doesn't seem to believe in permalinks. >:( Here's the new html link: tripplite.com/en/products/model.cfm?txtModelID=3914
    – Jason S
    Feb 20, 2009 at 22:37
  • p.s. we have the same model here at my company. It seems to work fine although tops out at 2x speed (230400bps). I tend to like the FTDI-based parts that get up to 3Mbps (have lately been using the UB232)
    – Jason S
    Feb 20, 2009 at 22:39
  • 1
    As I've posted in my other RxTx question, you were right Jason S. It was the USB device that was causing 'some' problems.
    – Jeach
    Oct 16, 2009 at 18:44
1

Using RxTx over usb-to-serial you can't set notifyOnOutput to true otherwise it locks up completely.

I've learned this the hard way. This problem is documented on a few web sites over the internet.

I'm running it on Linux and I believe that this is a Linux only issue, although I can't confirm that.

As for the link you've given me... I've seen the SimpleReader and SimpleWriter examples, but these don't represent a real world application. It is not multi-threaded, assumes a read has the full data it needs instead of buffering reads, etc.

Thanks,

Jeach!

1
  • I deleted my answer because it looked like a better one was given.
    – Chris
    Feb 15, 2009 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.