Linux serial port terminal gui

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

GTKTerm: A GTK+ Serial Port Terminal

License

Jeija/gtkterm

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Add missing #include directives, for C99 compatibility

Git stats

Files

Failed to load latest commit information.

README.md

GTKTerm: A GTK+ Serial Port Terminal

GTKTerm is a simple, graphical serial port terminal emulator for Linux and possibly other POSIX-compliant operating systems. It can be used to communicate with all kinds of devices with a serial interface, such as embedded computers, microcontrollers, modems, GPS receivers, CNC machines and more.

As GTKTerm is often used like a terminal emulator, the shortcut keys are assigned to , rather than just . This allows the user to send keystrokes of the form X and not have GTKTerm intercept them.

Key Combination Effect
L Clear screen
R Send file
Q Quit
S Configure port
V Paste
C Copy
F Find
K Clear Scrollback
A Select All
B Send Break
B Send break
F5 Open Port
F6 Close Port
F7 Toggle DTR
F8 Toggle RTS

See man gtkterm or gtkterm —help for more information on available command line interface options.

The RS485 flow control is a software user-space emulation and therefore may not work for all configurations (won’t respond quickly enough). If this is the case for your setup, you will need to either use a dedicated RS232 to RS485 converter, or look for a kernel level driver. This is an inherent limitation to user space programs.

Читайте также:  Linux joining pdf files

Scriptability with Signals

Some microcontrollers and other embedded devices are flashed using the same serial interface that is also used for outputting debug information. To facilitate rapid development on these platforms, GTKTerm supports the following UNIX signals:

Signal Action Usage Example
SIGUSR1 Open Port killall -USR1 gtkterm
SIGUSR2 Close Port killall -USR2 gtkterm

You may find it useful to send these signals in your own firmware flashing scripts.

GTKTerm has a few dependencies-

  • Gtk+3.0 (version 3.12 or higher)
  • vte (version 0.40 or higher)
  • intltool (version 0.40.0 or higher)
  • libgudev (version 229 or higher)

Once these dependencies are installed, most people should simply run:

meson build ninja -C build 

To install GTKTerm system-wide, run:

ninja -C build install gtk-update-icon-cache 

If you wish to install GTKTerm someplace other than the default directory, e.g. in /usr , use:

Then build and install as usual.

If you already deleted the build directory, just compile and install GTKTerm again as explained in the previous section with the same target location prefix ( -Dprefix ) and perform the uninstall step afterwards.

Original Code by: Julien Schmitt

This program 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, either version 3 of the License, 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. You should have received a copy of the GNU General Public License along with this program. If not, see . 

About

GTKTerm: A GTK+ Serial Port Terminal

Источник

Serial Terminal Emulator

This section lists command-line applications to communicate with the serial port.

Picocom​

Picocom is a simple and effective solution for those who like command-line:

$ picocom -b 115200 /dev/ttyUSB0 

Screen​

Screen is a good alternative for the picocom:

By default, if no option is specified, screen uses the standard 9600 baud rate.

Minicom​

Minicom is also a good choice to access the serial port on Linux. You can visualize the setup above by running the following command:

Minicom setup

In case you run Minicom without any additional arguments, it will use the default settings saved on /etc/minicom/minirc.dfl .

GUI options​

This section lists Graphical User Interface applications to communicate with the serial port.

GTKterm​

GTKterm is a simple GTK+ terminal that can be used on Linux to communicate with the serial port:

GTKterm client

Putty​

Putty is an SSH client that can also be used to communicate with the serial port on Windows and Linux:

Putty client

TeraTerm​

TeraTerm is a terminal emulator that can be used on Windows with the purpose to connect via SSH and also to access serial ports:

Источник

How to list all serial ports on Linux

Feature image for the article about how to list all serial ports on Linux

Linux comes with serial communication functionality built-in. Before you can communicate with a device, connected to your PC’s serial port, you just need to know the name of the serial port. On Windows it is typically COM1 , COM2 , etc. On Linux it is essentially a filename in the format of /dev/ttyS0 , /dev/ttyUSB0 or /dev/ttyACM0 . This article explains how to list all serial ports on a Linux based system.

Background

Especially when developing software for or interacting with microcontroller based systems, you often communicate using RS232 serial communication. Typically by means of an RS232-to-USB adapter. To communicate with an RS232 device, you need to know the name of the PC’s serial port to connect to. On Windows, you open up the device manager and look up the COM-port number. Listing the available serial ports on Linux is a bit different and desktop environments do not offer a graphical user interface to quickly identify the available serial ports. This article presents two methods for listing the serial ports on Linux. One with the help of a graphical user interface program and another one for working directly in the terminal.

What do you need

To complete the steps to list the available serial ports on Linux, you just need two things:

  • A Linux based PC. It can be a desktop, server, virtual machine or a single board computer such as a Raspberry PI.
  • A serial device connected to the PC. For example an RS232-to-USB adapter, an Arduino or a Raspberry Pico.

For this article I’ll be using my main openSUSE Tumbleweed system. It’s a Lenovo ThinkCentre with one actual physical serial port. Additionally, I connected two serial devices: An RS232-to-USB adapter and an Arduino Uno.

Listing the serial ports using a Linux GUI application

Unfortunately, Linux desktop environments do not offer a GUI program to quickly and conveniently show all the available serial ports. However we can simply install one that does. Chances are you want a GUI program for monitoring the serial port in Linux anyway. My recommendation: CuteCom. Installation instructions for CuteCom on popular Linux distributions:

  • Debian and Ubuntu: sudo apt install cutecom
  • Fedora: sudo dnf install cutecom
  • openSUSE: sudo zypper install cutecom

Once installed, open up the CuteCom program. It shows a Device drop-down list on the top of the main window. And voilà, it lists all serial ports on your Linux system:

CuteCom screenshot highlighting how you can use it to list the Linux serial port devices.

As you can see in the screenshot, CuteCom lists all three serial ports currently connected to my Linux system:

  • /dev/ttyS0 → The physical serial port on my PC.
  • /dev/ttyUSB0 → The RS232-to-USB adapter.
  • /dev/ttyACM0 → The Arduino Uno board connected via USB cable.

Listing the serial ports using the Linux terminal

The past section showed that Linux assigns a file name to serial devices with the acronym TTY in it. TTY stands for teletypewriter. With these historical devices you could send typed text messages to a remote location, using serial communication. Eventually leading to the invention of the fax machine. Hardly anyone still uses these devices. Nevertheless, the term TTY stuck around.

When it comes to using the terminal to list the serial ports, I prefer the approach that looks for TTY devices that the Linux kernel detected. Basically those that it found and managed to assign a driver to. The following command lists all of these:

Terminal screenshot that show you how to list all serial devices detected by the Linux kernel.

  • ls -l /sys/class/tty/*/device/driver

That’s a long list. I expected just three devices. The command output includes all so-called virtual and pseudo terminals. We just want to list the actual hardware serial ports. We can filter out the ones we don’t want by removing all lines that contain platform/drivers/serial8250 . The command then becomes:

Terminal screenshot that shows you how to list all serial devices detected by the Linux kernel, exluding the virtual and pseudo terminals.

  • ls -l /sys/class/tty/*/device/driver | grep -v «platform/drivers/serial8250»

Alright, that looks a lot better. The output lists the three TTY devices that I expected: ttyACM0 , ttyS0 and ttyUSB0 . Ideally, the output shows just the actual device filename, needed to connect to the serial port. With a little akw magic, we can clean the output up for this:

Final terminal output of listing the serial port devices on Linux. This time it outputs the correct device names, needed to connect to the serial port device.

  • ls -l /sys/class/tty/*/device/driver | grep -v «platform/drivers/serial8250″ | awk » | awk -F’/’ »

Bash alias for listing the serial ports

I enjoy making one-liners for the terminal to get stuff done. However, the length of this one is such that I will never remember it. And I bet that’s the thought that crossed your mind too. Two options to solve this:

  1. Bookmark this page in your web browser and visit it whenever you need to list the serial ports from the terminal.
  2. Create a Bash alias.

With a Bash alias you essentially add a new command to your user’s shell with a name of your choice. Aliases are stored in the .bashrc file inside your home directory. You can edit it with whatever text editor you prefer. I’ll just use good old Nano:

Once in the text editor, add the following line. Note that escape characters were added where needed, to make it work. That’s before every double-quote and dollar sign:

Editing .bashrc to add the

  • alias lsserial=»ls -l /sys/class/tty/*/device/driver | grep -v \»platform/drivers/serial8250\» | awk » | awk -F’/’ »»

Once done, save your .bashrc file and type this command to reload it:

Alternatively, you can just close and reopen your terminal program.

From now on you can list the available serial ports on your Linux PC, by simply typing this command in the terminal:

Terminal screenshot showing the output of the newly added

  • lsserial

Wrap up

This article presented you with two different methods for listing the available serial ports on your Linux PC.

  1. Using the CuteCom GUI application.
  2. Piping several commands together for a terminal one-liner.

Going with method two, this article explained how you can add a Bash alias for the constructed terminal one-liner. Afterwards you can list the serial devices by simply typing the lsserial command in the terminal.

If you work with serial ports in Linux, you might be interested in one of the other serial port related articles:

Источник

Оцените статью
Adblock
detector