Serial Port Module?
Posted: Thu Jun 26, 2014 2:56 am
I have noticed there are no APIs in newLISP for this fairly common piece of hardware. I have written a working prototype of this functionality that works for the newLISP Linux version. Hopefully it will also work with other UNIX platforms. I was wondering if there was anyway to get this module incorporated into newLISP officially. It has two parts. There's the C source code which acts as an intermediate layer that abstracts the platform specific code for opening, closing, reading, writing, and configuring serial ports. And then there's the newLISP interface module which binds the simple public C API of the serial port abstraction library into an easy to use FOOP class. The repo for my prototype can be found here: https://github.com/ryuo/newlisp-serial-port
There is also a short script in the repo that I wrote to test the module with an LCD character display that is controlled through a USB serial port adapter.
However, I have no plans to support serial port features that lack convenient access in the underlying platform API. This likely means no DSR/DTR flow control and no Space or Mark Parity. These features appear to be absent from any high level OS abstraction API for serial ports. It's not part of the termios abstraction (the POSIX API for serial ports and other terminal devices). I've only seen it possible to support these features via platform specific usage of ioctl, which is far less portable than using the higher level termios API. Considering I rarely see any hardware that requires these features, I feel it's a waste of time to try to support it. I envision this module as a lightweight abstraction for serial ports on most platforms that newLISP will run on. For now, I wish to keep the supported features restricted to things that will probably work on most of the platforms. However, there's at least two platform specific details that cannot be avoided: the list of supported baud rates and the list of available serial ports. So, I still need to add an API to get a list of all the supported baud rates and available serial ports for the platform that newLISP is running on.
Anyway, thoughts, commentary? Thanks.
There is also a short script in the repo that I wrote to test the module with an LCD character display that is controlled through a USB serial port adapter.
However, I have no plans to support serial port features that lack convenient access in the underlying platform API. This likely means no DSR/DTR flow control and no Space or Mark Parity. These features appear to be absent from any high level OS abstraction API for serial ports. It's not part of the termios abstraction (the POSIX API for serial ports and other terminal devices). I've only seen it possible to support these features via platform specific usage of ioctl, which is far less portable than using the higher level termios API. Considering I rarely see any hardware that requires these features, I feel it's a waste of time to try to support it. I envision this module as a lightweight abstraction for serial ports on most platforms that newLISP will run on. For now, I wish to keep the supported features restricted to things that will probably work on most of the platforms. However, there's at least two platform specific details that cannot be avoided: the list of supported baud rates and the list of available serial ports. So, I still need to add an API to get a list of all the supported baud rates and available serial ports for the platform that newLISP is running on.
Anyway, thoughts, commentary? Thanks.