[ltp] Serial port switch

Javier Pérez Fernández linux-thinkpad@linux-thinkpad.org
Sat, 15 Mar 2008 20:42:47 +0100


On Wed, Mar 12, 2008 at 3:17 AM, Richard Neill <rn214@hermes.cam.ac.uk> wrote:
> Dear All,
[...]
>  The old-fashioned Serial port (or a USB-serial adaptor) has a couple of
>  status lines which are really easy to monitor and interface with. It's
>  also reasonable electrically "tough", being designed to work with large
>  voltage-swings, and long cables.
>
RS232 is tough, yes, but I don't want risks with the RS232 of my T23 laptop.
I make serial experiments on a old Pentium-1 desktop.

>  statserial  /dev/ttyS0    gives the following listing, for a
>  non-connected port:
>
>  -------------------
>  Device: /dev/ttyS0
>
>  Signal  Pin  Pin  Direction  Status  Full
>  Name    (25) (9)  (computer)         Name
>  -----   ---  ---  ---------  ------  -----
>  FG       1    -      -           -   Frame Ground
>  TxD      2    3      out         -   Transmit Data
>  RxD      3    2      in          -   Receive  Data
>  RTS      4    7      out         1   Request To Send
>  CTS      5    8      in          0   Clear To Send
>  DSR      6    6      in          0   Data Set Ready
>  GND      7    5      -           -   Signal Ground
>  DCD      8    1      in          0   Data Carrier Detect
>  DTR     20    4      out         1   Data Terminal Ready
>  RI      22    9      in          0   Ring Indicator
>  --------------------
>
Woow, this is a great utility, statserial(1). I didn't know it. Thanks!!!
I have only played with the serial status showed by GNU screen.


>  So, if we connect a switch between pin 4 (RTS,out,logic 1), and pin 9
>  (RI,in,floats at 0), then we can very easily read the state of the
>  switch.  The circuit really is this simple:
[...]
>  In practice, we have up to 4 inputs and 1 outputs available, as well as
>  a small amount of unregulated power.
>
Indeed, we have 2 outputs as General Purpose pins: RTS and DTR

>  Hope this is of interest.
>
This is OFF-TOPIC here, but it is of great interest for me. Thanks.

AlBundy.