Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclusive serial port access on OSX

I'm working on an open source program that uses gnu.io (RXTX) to talk to a microcontroller over a USB serial port. The app runs on Windows, Linux and OSX. It relies on gnu.io for portable serial port access. One Macbook user has posted a log showing evidence of two things:

  • While the application has the serial port open something causes RTS to pulse, resetting the microcontroller.
  • While the application has the serial port open something changes the baudrate temporarily, causing garbage to appear on the input. (Normally this microcontroller/firmware/USB combination is not susceptible to "line noise" style garbage characteristic of bad baud rates).
  • This happens periodically while the application sits idle (reacting/logging when spontaneous messages arrive after the RTS induced reset)

I suspect that some other program is opening the same serial port occasionally (eg searching for a connected device). How do I prevent that on OSX?

like image 467
Ben Jackson Avatar asked Apr 09 '11 20:04

Ben Jackson


People also ask

What is a serial port on a computer?

A serial port is an interface that allows a PC to transmit or receive data one bit at a time. It is one of the oldest types of interfaces and at one time was commonly used to connect printers and external modems to a PC.


1 Answers

as far as I know, RXTX does not allow anyone else to use a Serial port it's using, and throws an exception if the port is already in use when it tries to open it. sounds like a RXTX bug to me

like image 177
Gavin S. Yancey Avatar answered Oct 04 '22 13:10

Gavin S. Yancey