Permalink
Switch branches/tags
Commits on Aug 31, 2017
Commits on Aug 15, 2017
Commits on Aug 14, 2017
  1. fdopen: release resource immediately

    msantos committed Aug 14, 2017
    Instead of relying on the caller to call close/1, release the resource
    immediately so the garbage collector can close the fd if the term goes
    out of scope.
    
    If close/1 is used, close(2) the fd instead of relying on the resource
    cleanup so any errors can be returned to the caller.
Commits on Oct 14, 2016
  1. Fix type specs

    msantos committed Oct 14, 2016
Commits on Oct 13, 2016
  1. Add dialyzer warnings

    msantos committed Oct 13, 2016
Commits on Mar 10, 2016
  1. Use common test

    msantos committed Mar 10, 2016
Commits on Mar 4, 2016
  1. Fix Makefile

    msantos committed Mar 4, 2016
    Any make target failed with:
    
    make: *** No rule to make target 'rebar3', needed by 'compile'.  Stop.
    
    Reported by @jj1bdx in #4
Commits on Aug 13, 2015
  1. Adapting the main Makefile for rebar3.

    nrdufour authored and msantos committed Aug 12, 2015
  2. Porting srly to rebar3.

    nrdufour authored and msantos committed Aug 12, 2015
Commits on Jul 31, 2015
  1. srly: handle fd errors

    msantos committed Jul 31, 2015
    Any read/write errors will cause the port to close. srly will receive an
    'EXIT' message from the port.
    
    Always return 'ok' from close/1 since the gen_server may have stopped
    due to the port exiting.
Commits on Jul 30, 2015
  1. write/2: check for partial writes in Erlang code

    msantos committed Jul 30, 2015
    Simplify the C code by always returning the number of bytes written.
    Check for a complete write in the Erlang code and return the atom 'ok'.
Commits on Jun 26, 2015
Commits on Jun 22, 2015
  1. tcsetattr/3: add tcsasoft

    msantos committed Jun 22, 2015
Commits on Jun 20, 2015
  1. Fix dialyzer warnings

    msantos committed Jun 20, 2015
  2. serctl: fix handling of invalid constants

    msantos committed Jun 20, 2015
    A bug in the handling of non-portable/invalid constants would result
    in an infinite loop. Better define the behaviour of atoms when used as
    constants:
    
    * tcsetattr/3
    
      If the action atom is not supported on this platform, return
      {error,unsupported}. The documentation lists only 3 valid atoms
      (tcsanow, tcsadrain, tcsaflush), however it is possible that some
      platforms may support other actions (e.g., TCSASOFT on the BSDs).
    
    * cfsetispeed/2, cfsetospeed/2, ispeed/2, ospeed/2
    
      These functions do not return an error. Use of an invalid speed on
      this platform will generate a badarg. Portable code will have to
      either test the atom using constant/1 or catch the badarg.
Commits on Jun 19, 2015
Commits on Jun 18, 2015
  1. readme: update constants

    msantos committed Jun 18, 2015
Commits on Jun 17, 2015
  1. examples/strobe: remove check for flow control

    msantos committed Jun 17, 2015
    From Bob Ballance:
    
        Another note — I’m using the FTDI drivers suggested by Arduino and
        AdaFruit on my Mac. They have the funny attribute that when you get
        attributes, the flow control is *always* set. So I can set the `flow`
        to false without an error, but the next call to `tcgetattr` shows the
        flow as being true.   This is not the case with a raw tty, just with
        the ‘usb.modem’ device attached to the Arduino.
    
        As a result, the following line in the strobe example fails:
    
            ok = serctl:tcsetattr(FD, tcsanow, Termios),
    
            {ok, Termios1} = serctl:tcgetattr(FD),
        >>>    false = serctl:flow(Termios1),
    
        I  tested the behavior with raw C code, and confirmed it.
    
    Thanks Bob!
  2. Fix termios on 64-bit Mac OS X

    msantos committed Jun 17, 2015
    struct termios fields on Mac OS X are 8 bytes when running a 64-bit
    version of erlang.
    
    Thanks to Bob Ballance for discovering the problem and providing a fix!
Commits on May 18, 2015
  1. constants: add TIOCMSET

    msantos committed May 18, 2015
Commits on May 17, 2015
  1. Update README

    msantos committed May 17, 2015
    Remove some of the scary language. Hopefully most of the portability
    issues have now been dealt with. The runtime lookup of termios, etc., is
    not performance critical. Most applications will be doing read/writes to
    the serial device. As for the safety of the native serial interface,
    that makes srly useful for finding bugs in the OS!
    
    Also remove the note about needing to set the serial device into raw
    mode. There are 2 situations where blocking mode might be used:
    
    * the caller passes in a fd opened by other means
    
      There's a note already explaining that the fd should be opened in
      O_NONBLOCK|O_NOCTTY mode.
    
    * the caller uses tcsetattr/3 to change the mode
Commits on Feb 24, 2015
Commits on Jan 31, 2015
  1. Bump version and tag

    msantos committed Jan 31, 2015
    Increment the version and mark this as the stable release:
    
    #2
    
    Thanks wmealing!
  2. Fix termios/1 on Solaris

    msantos committed Jan 31, 2015
    struct termios on Solaris does not contain the ispeed/ospeed fields.
    Add a special case just for solaris.
    
    Testing was done on a SmartOS VM without a serial port. To simulate:
    
        export SRLY_TEST_PORT=/dev/tty
        make test
Commits on Jan 16, 2015
  1. Add hw tests for non-destructive functions

    msantos committed Jan 16, 2015
    Test requiring hardware. To use the environment variable must be set:
    
        export SRLY_TEST_PORT=/dev/ttyUSB0
  2. Add test for constant/0,1

    msantos committed Jan 16, 2015
    Add a test that will at least exercise loading and running the NIF.
Commits on Jan 15, 2015
  1. serctl: add typespecs

    msantos committed Jan 15, 2015
Commits on Jan 14, 2015
  1. readx: perform selective/receive on mailbox

    msantos committed Jan 14, 2015
    Use a tagged tuple in the response when reading from the serial port to
    avoid readx/2,3 from matching any message in the process mailbox.
    
    Reported in #1. Thanks
    JayThomason!
Commits on Dec 30, 2014
  1. Compilation fix for Solaris

    msantos committed Dec 30, 2014
Commits on Nov 25, 2014
  1. Include support for NetBSD and OpenBSD

    msantos committed Nov 25, 2014
    From inspection of the header files, struct termios under Net/OpenBSD is
    identical to FreeBSD.
Commits on Nov 24, 2014
  1. cfset[io]speed: crash on allocation failure

    msantos committed Nov 24, 2014
    The cfsetispeed(3) and cfsetospeed(3) functions do not fail, however
    the NIF wrapper may fail while trying to allocate memory. Instead of
    expecting the caller to test for an error condition, generate a badarg
    exception, since the error is likely non-recoverable anyway.
Commits on Nov 23, 2014
  1. Bump the version

    msantos committed Nov 23, 2014
    Increment the version for typespec changes. Further planned
    improvements:
    
    * complete typespecs
    * add tests, at least for the functions not dealing with i/o
    * fix the return value of cfsetospeed/cfsetispeed
    
      Functions return:
    
        binary() | {error,enomem}
    
      Since these functions may fail, they should either throw an exception
      on allocation failure or, for pattern matching, be changed to return:
    
        {ok,binary()} | {error,enomem}
    
    * per suggestion, make srly into a well behaved application
    
      srly should be able to deal with the addition and removal of USB
      serial ports.
    
    * optionally use inert for flow control of data from the serial port