Serial Communications Jinni

Sample Scripts
Sjinn Project Page

SourceForge Logo

Command Reference


Usage: sjinn [options] ...
Example: sjinn -d /dev/ttyS1 -b600 -p7n2 -s "d\n" -r16

Communication Settings

-d, --file STRING serial I/O device default /dev/ttyS0
-b, --baud INT set baudrate default 9600
-p, --comm INT set (databits)(parity)(stopbits) default 8n1
--xonxoff BOOLEAN XON/XOFF (software flow control) default off
--rtscts BOOLEAN RTS/CTS (hardware flow control) default off
--dtr BOOLEAN disable DTR default enabled
--rts BOOLEAN enable RTS default disabled
-s, --send STRING write string to device
-r, --read INT read n characters from device
-w, --wait FLOAT seconds between send and read default 0.5
--pause FLOAT wait time for pause-character default = --wait
-m, --msec INT specify \w and \p times in mSec instead of seconds

Format Options

--hex BOOLEAN display read buffer in hex default = ASCII
--hex+ BOOLEAN display read buffer in hex + ASCII default = ASCII
--wrap INT wrap lines at n characters
--trim INT truncate lines at n characters
-n, --nolf BOOLEAN do not output the trailing new line

Program Options

-h --help display this help and exit
-V, --version output version and exit

Supported Send String Control Characters

\\ Back-Slash
\- Minus-Sign (dash)
\n LF
\r CR
\p Pause, delay number of seconds/mSec defined by --pause
\w Wait, delay number of seconds/mSec specified
\h Hex Mode, toggle to/from hex mode

General Notes

  • ASCII codes less than 32 or greater than 127 are output as "." characters

Command Syntax Notes

  • If you use the -p option you must include all three values: Data length, parity and stop bits. The values can be strung together, separated by commas or spaces. For example "-p8n1" or "-p8,n,1" and "-p8 n 1" all work, but "-p8n" and "-p8" do not work.
  • Hex values must be exactly 2-characters long. For example to send 13 and 10 in hex use "\h0d 0a" and not "\hd a" or "\hda". Separating hex values by spaces is optional "\h0d0a" also works.
  • When sending a single null character use -s"\0" and not -s"" or -s

Syntax Notes on Delay Parameters

  • If the pause parameter "-p" or "--pause" is not specified then "\p" delays will default to the wait parameter delay time.
  • Don't confuse "-w" and "\w". The "-w or --wait" is a command line parameter and is the delay time between send and read as opposed to "\w" which is a control character providing a custom in-line delay time inside a send string. "\w" inserts a delay between characters being sent out. "-w" is used frequently, whereas "\w" is rarely used, see the bullet below.
  • When setting delays in your command string use "\p". Only use "\w" when you require varrying delay times inside the same send string.
  • The value specified after a "\w" must be followed by a space or an end of string. For example to set an in-line wait time of 500ms use "\w.5 \r" or "\w.5" and not "\w.5\r"
  • The wait time parameter "-w" is not affected by the "-m" parameter. "-m" indicates that all in-line send string delays such as "\p" and "\w" will be specified in miliseconds, just be aware that this is not applied to the "-w" or "--wait" command-line parameter.

Troubleshooting Tips

  • Insufficient wait time between send and read is a common source of error. Use the "-w" command-line parameter to specify wait time. It usually pays off to start out with excess wait times. That is why I chose to always specify wait time in seconds and not in milliseconds. The only reason the default of 0.5 seconds was chosen instead of a longer time was so that new S-Jinn users don't think the program is hung when they first run it.
  • Improper termniation of commands in send strings is a common source of error. The termination characters required are specific to the particular device you are communicating with. For example some devices want '\n' instead of '\r', and yes this can make a difference. Please read your device manual for details.
  • Neglecting to check whether the device is configured as a DTE is a common source of error. A PC is normally a DTE therefore a null modem cable is required if the device is also a DTE.