Rechercher une page de manuel

Chercher une autre page de manuel:


Langue: en

Version: 0.4.4 (mandriva - 01/05/08)

Section: 1 (Commandes utilisateur)


slsnif - Serial line sniffer


slsnif [-b] [-l logfile] [-i file] [-o file] [-s speed] [-t] [-x] [-p port2] [--color color] [--timecolor color] [--bytescolor color] [-n] [-u] port1


slsnif is a serial line sniffer software. It listens to the specified serial port and writes all data coming through it into either stdout (default) or a log file (if specified -- see option -l).

slsnif operates either by creating a pseudo tty (pty) and linking it to the serial port, or by linking two serial ports together. In order to set up a debug session one has either to start slsnif on a given port first, note the pty it had 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, in case of two ports being used, simply 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 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 ( and pty is used, port in question should be disconnected from vmware before invoking slsnif, and connected to the opened pty after slsnif has been started.


slsnif accepts the following parameters:
<port1> (required)
First (and only one in case of pty being used) serial port to listen to. (/dev/ttyS0, /dev/ttyS1, etc.)


[-l <logfile>] ([--log <logfile>])
File to direct output to. Output is sent to stdout by default.
[-i <in-file>] ([--in-tee <in-file>])
File to dump raw data from device to. Multiple '-i' / '--in-tee' arguments result in multiple copies of data in corresponding files.
[-o <out-file>] ([--out-tee <out-file>])
File to dump raw data from host to. Multiple '-o' / '--out-tee' arguments result in multiple copies of data in corresponding files.
[-s <speed>] ([--speed <speed>])
Baudrate to use. Valid options are:
50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
Defaults to 9600 baud.
[-b] ([--bytes])
Print number of bytes transmitted on every read.
[-p <port2>] ([--port2 <port2>])
Use real serial port instead of pty. 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 lock directory (usually /var/lock/)
[-t] ([--timestamp])
Print timestamp for every transmission.
[-x] ([--hex])
Display hexadecimal ascii values.
[-u] ([--unix98])
Use SYSV (Unix98) ptys instead of BSD ptys.
[--color <color>]
Color to use for normal output.
[--timecolor <color>]
Color to use for timestamp.
[--bytescolor <color>]
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, and brightwhite.
[-h] ([--help])
Display help.


The following options can be specified via rc-file '.slsnifrc', which should be located in the user's home directory:

-- corresponds to -b (--bytes).
-- corresponds to -t (--timestamp).
-- corresponds to -x (--hex).
-- corresponds to -n (--nolock).
-- corresponds to -u (--unix98).
COLOR <color>
-- corresponds to --color <color>.
-- corresponds to --timecolor <color>.
-- corresponds to --bytescolor <color>.

Options specified via command line always override the ones specified via rc-file.


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.


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.


setserial(8), stty(1).


Yan Gurtovoy <>.
Le rire c'est comme les essuie-glaces, il permet d'avancer
même s'il n'arrête pas la pluie !
-+- Gérard Jugnot -+-