SLSNIF(1)
π¦ slsnif(1) β the serial line sniffer π¦
Manual name: slsnif(1). Category: Debug. Okay bestie, buckle up π
πΈ NAME πΈ
slsnif β serial line sniffer, aka your little wiretap for serial traffic β¨
π SYNOPSIS π
slsnif [-b] [-l logfile] [-i file] [-o file] [-s speed] [-t] [-x]
[-p port2] [--color color] [--timecolor color] [--bytescolor color] [-n]
[-u] port1
π DESCRIPTION π
Okay so slsnif is serial line sniffer software, fr fr. It listens to the serial port you specify and writes all data coming through it into either stdout β that's the default β or a log file if you specify one with option -l.
It operates either by creating a pseudo tty (pty) and linking it to the serial port, or by linking two serial ports together. To set up a debug session, you either start slsnif on a given port first, note the pty it opened β also available from file /tmp/slsnif_pty while slsnif is running β then configure the controlling software for the device being debugged to use this pty instead of the actual port. Or, if you're using two ports, just start slsnif on two ports (see option -p) and watch the show :)
Note 1: slsnif will try to match port settings on pty and port (or on 1st and 2nd ports) as soon as it detects the first chunk of data coming from the "host side" (which is either pty or 2nd port). If it fails β in case of a braindead controlling software that doesn't set the baudrate correctly β one has an ability to set baudrate by hand via option -s. Controlling software and slsnif should be set up to use the same baudrate, which in turn should match the baudrate used by the device connected to the port.
Note 2: If controlling software is running under vmware (www.vmware.com) andptyis used, the port in question should be disconnected from vmware before invokingslsnif, and connected to the openedptyafterslsnifhas been started. π
π PARAMETERS π
slsnif accepts the following parameters:
<port1>(required) β first serial port to listen to (and the only one in case ofptybeing used). Examples:/dev/ttyS0,/dev/ttyS1, etc. π«Ά
β¨ OPTIONS β¨
-llogfile,--loglogfile β file to direct output to. Output is sent tostdoutby default.-iin-file,--in-teein-file β file to dump raw data from device to. Multiple-i/--in-teearguments result in multiple copies of data in corresponding files.-oout-file,--out-teeout-file β file to dump raw data from host to. Multiple-o/--out-teearguments result in multiple copies of data in corresponding files.-sspeed,--speedspeed β baudrate to use. Valid options are:50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,19200,38400,57600,115200. Defaults to9600baud.-b,--bytesβ print number of bytes transmitted on every read.-pport2,--port2port2 β use real serial port instead ofpty. Useful when one needs to log data going between two ports.-n,--nolockβ disable locking of the port. Normally not a good idea, but can be very useful if one doesn't have permissions to write to the lock directory (usually/var/lock/).-t,--timestampβ print timestamp for every transmission.-x,--hexβ display hexadecimal ascii values.-u,--unix98β use SYSV (Unix98)ptysinstead of BSDptys.--colorcolor β color to use for normal output.--timecolorcolor β color to use for timestamp.--bytescolorcolor β color to use for number of bytes transmitted. Valid<color>values are:black,red,green,yellow,blue,magenta,cyan,white,brightblack,brightred,brightgreen,brightyellow,brightblue,brightmagenta,brightcyan, andbrightwhite.-h,--helpβ display help.
π§ RC FILE π§
The following options can be specified via rc-file .slsnifrc, which should be located in the user's home directory:
TOTALBYTES ON/OFFβ corresponds to-b(--bytes).TIMESTAMP ON/OFFβ corresponds to-t(--timestamp).DISPLAYHEX ON/OFFβ corresponds to-x(--hex).NOLOCK ON/OFFβ corresponds to-n(--nolock).SYSVPTY ON/OFFβ corresponds to-u(--unix98).COLOR <color>β corresponds to--color <color>.TIMECOLOR <color>β corresponds to--timecolor <color>.BYTESCOLOR <color>β corresponds to--bytescolor <color>.
Options specified via command line always override the ones specified via rc-file. Periodt π
π₯ EXAMPLE π₯
slsnif -n -l log.txt -s 2400 /dev/ttyS1
Started logging data into file 'log.txt'.
Opened pty: /dev/ttyp0
Saved name of the pty opened into file '/tmp/slsnif_pty'.
Opened port: /dev/ttyS1
Baudrate is set to 2400 baud.
Note: pty slsnif has opened is /dev/ttyp0.
π SIGNALS π
SIGHUP signal causes slsnif to move file pointer in all log files back to the beginning. This is useful for example when logfiles are rotated by logrotate. SIGUSR1 signal causes slsnif to re-synchronize settings between ttys at any time. Useful for debugging software that changes port settings in the middle of transmission. π¦
π SEE ALSO π
π AUTHOR π
Yan Gurtovoy <ymg@dakotacom.net>.
Cute footer sign-off, bestie: Yan Gurtovoy, version 0.4.4, manual SLSNIF(1) β no date printed, just iconic legacy energy πβ¨
π¦ where this page comes from
- nixos 26.05: slsnif 0.4.4
- nixpkgs unstable: slsnif 0.4.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms