Crates.io | sericom |
lib.rs | sericom |
version | 0.5.4 |
created_at | 2025-08-28 20:50:06.010074+00 |
updated_at | 2025-09-25 21:03:35.006906+00 |
description | CLI tool for communicating with devices over a serial connection. |
homepage | https://github.com/tkatter/sericom |
repository | https://github.com/tkatter/sericom |
max_upload_size | |
id | 1814610 |
size | 146,445 |
This repository houses the Sericom CLI application, a tool for communicating with devices over serial connection, and its underlying library Sericom-core.
Sericom is a CLI tool for communicating with devices over a serial connection.
The goal of Sericom, going forward, is to serve as an automation tool to execute tasks on devices via a serial connection. Sericom was originally developed with the intention of communicating with networking devices (switches, routers, firewalls, etc), and automating the process of tasks like: running tests and saving the results to a file, performing a configuration reset, configuring a device, etc. Even though Sericom was initially developed to be used with networking devices, the intention going forward is to be compatible (from an automation standpoint) with most devices. On that note, if you encounter an issue or problem, please open a Github issue.
To install Sericom from crates.io, you will need to have Rust and Rust's package manager Cargo installed (if you have a standard installation of Rust, you should also have Cargo installed).
To check that Rust and Cargo are installed, run the following commands:
rustc --version
cargo --version
To install Sericom from crates.io, run:
cargo install sericom
Sericom will be installed in $HOME/.cargo/bin/
. As long as that directory is
in your PATH
, you should be able to start using Sericom!
For binaries and Windows installers, head over to the releases page to grab the download and follow the instructions pertaining to the download.
In order to build from source, you will need to have Rust and Cargo installed (Rust's installation instructions).
Clone the repository and build with Cargo in the main branch:
git clone https://github.com/tkatter/sericom.git
cd sericom
cargo build --release
Cargo will build the binary and put it in sericom/target/release/sericom
.
To open a connection to a serial port (uses a default baud rate of 9600):
# Syntax
sericom <PORT>
# Windows
sericom.exe COM4
# Linux
sericom /dev/ttyUSB0
To open a connection and write everything received to a file:
# Syntax
sericom -f <PATH_TO_FILE> <PORT>
-f
without a file path and it will default to a file name
of <PORT_NAME>-<TIMESTAMP>.txt
in the default out-dir.To get a list of all the valid baud rates:
sericom bauds
To see all of the available serial ports:
sericom ports
Sericom can be configured via a config.toml
file. Sericom looks for this file
in the $HOME/.config/sericom/
directory. You may specify as little or as many
configurations as you'd like, for any that are not defined in your config, Sericom
will fall back to its defaults.
Currently the available configuration options are as follows:
[appearance]
# Control the foreground and background colors
fg = "green"
bg = "none"
[defaults]
# The default directory where files will be written to when running `sericom -f <FILE>`
out-dir = "./"
# Path to an executable to run after writing to a file
exit-script = "~/path/to/script"
[!NOTE] Behavior of the
out_dir
configuration When using a relative path with the-f
flag, Sericom will recursively create the file within whatever is set as theout_dir
(by default it is the current directory where sericom was run ("./"
)).When using an absolute path with the
-f
flag, Sericom will ignore theout_dir
config value and recursively create the file at the location of the absolute path.Examples
# Using the default value of `out_dir`, which is ./ (current directory) $ pwd # /home/thomas/device_files $ sericom -f c2960.txt # file is created at /home/thomas/device_files/c2960.txt $ sericom -f tests/c2960.txt # file is created at /home/thomas/device_files/tests/c2960.txt $ sericom -f ../c2960.txt # file is created at /home/thomas/c2960.txt $ sericom -f /home/thomas/other_tests/c2960.txt # file is created at /home/thomas/other_tests/c2960.txt $ sericom -f $HOME/c2960.txt # file is created at /home/thomas/c2960.txt
Sericom can also be passed configuration overrides as CLI arguments:
$ sericom /dev/ttyUSB0 --color magenta --out-dir /some/other/dir
A list of all the available options can be found here.
If there are additional configuration options you would like to see added, please open an issue!
send! "show inventory"
grep! first! "SN:"
|> get! word! "SN: $1"
|> set! SN=$1
|> writef_ln! "Serial number: '$SN'"
Need to add user to the correct group to avoid getting Permission Denied
errors.
Use ls -l /dev/tty*
to check the group of the serial ports - in my case it was dialout
.
Add user to the dialout
group with sudo usermod -a -G dialout $USER
.
This program, Sericom, is licensed under the GNU GPL v3.0.
This program, Sericom, is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Note: The author reserves the right to offer this software under a separate commercial license at a future date for those who wish to use it outside the terms of the GPLv3.
The sericom-core
library is released under a MIT license.