Menu

linux_serial_howto Log in to Edit

Linux Serial Port Setup

You need to be a member of the group that owns the serial port device connected to your rig. On Debian-based systems such as Debian GNU/Linux, Ubuntu and its derivatives (Kubuntu, Xubuntu, Lubuntu etc.) and Mint, just to name a few, this is the "dialout" group. On other systems you can determine the group you need to join with this command:

$ ls -l /dev/ttyUSB*

(If this doesn't return any files, use ''ls -l /dev/ttyS*'' instead.)

This should give you a list of one or more serial port devices of the form:

crw-rw---- 1 root uucp 188, 0 Jul 22 02:49 /dev/ttyUSB0

In this case the serial device is owned by user "root" and group "uucp", so you want to add yourself to the "uucp" group. In the examples below we will use "dialout" for the group we need to join.

There are several ways to add yourself to a group.

From a terminal, you can enter the following command

$ sudo adduser (username) dialout

Substitute your login name for (username)

You can check to be sure that you are now a member of the dialout group with the command:

$ groups

which should respond with the full list of groups you belong to.

There are also Graphical User Interface tools that perform the same basic function. On Lubuntu this is the "users-admin" command which is usually found on the Lubuntu menu item "System Tools | Users and groups". You can of course start that tool from the command line

$ sudo users-admin

sudo is used for all of these modifications to ensure that you have the correct read/write privilege for the files that will be changed. You may need to log out and log back in again for the change to take effect.

Mint distribution

Contributed by Charlie, NA5NM

  • Goto "Menu" and select "Control Center."
  • In the "Control Center" select "Users and Groups."
  • Under "Users and Groups" you will select "Manage Groups"
  • A list of all the different groups will appear so you may scroll through the list to find 'dialout' select it then press the "Add" key.
  • You need to log out and log back in again for the changes to take effect.

Ubuntu Unity desktop

Contributed by Dave, WB5NHL

  • Click on "Dash Home" symbol in upper left corner of the desktop
  • Key "users" click on the "Users and Groups" icon
  • Select "Manage Groups"
  • A list of all the different groups will appear so you may scroll through the list to find 'dialout'
  • Highlight "dialout" and select "Properties"
  • If the box next to your name is checked, you are a member of the dialout group. If not, check the box!
  • You need to log out and log back in again for the changes to take effect.

Korora (based on Fedora)

Contributed by John, KC5LAA

  • Go to “Menu” and select “Administration” > “Users and Groups”
  • Under “Edit” select “Preferences” and uncheck “Hide system users and groups”, then exit “Administration”
  • Select “Groups” tab
  • A list of all the different groups will appear so you may scroll through the list to find “dialout”
  • Highlight “dialout” and select “Properties”
  • Select “Group Users” tab
  • Scroll down through the list of users to find your name.
  • Make sure the box next to your name is checked.
  • Select “OK” to exit the “Properties” window.
  • Exit “Users and Groups” window

You need to log out and log back in again for the changes to take effect.

USB->RS232 adapters

The serial drivers may need to be installed for the device to work properly. After plugging in the device, first check the hardware messages to see the device was detected:

$ dmesg

Toward the end of the messages, you should see this:

usb 1-1: new full speed USB device using uhci_and address 2
usb 1-1: configuration #1 chosen from 1 choice

Now, we need to figure out the device vendor number and product number to tell the usbserial driver. For this we can use lsusb. The easiest way to find the information is to first unplug the device, then run lsusb:

$ lsusb

You will see a summary list of your USB devices on the system, for example:

Bus 001 Device 001: ID 0000:0000

Now, plug the device back in, and run lsusb again:

$ lsusb

Which returns the summary list again, but now showing the new USB device:

Bus 001 Device 002: ID 4348:5523
Bus 001 Device 001: ID 0000:0000

Now, we can load up the driver for this device:

sudo modprobe usbserial vendor=0x4348 product=0x5523

Finally, check dmesg again to ensure it loaded properly.

$ dmesg

Near the end, you should see something like:

usbserial_generic 1-1:1.0: generic converter detected
usb 1-1: generic converter now attached to ttyUSB0
usbcore: registered new interface driver usbserial_generic

Congratulations, your link is up - in this example, the device can be used on /dev/ttyUSB0. As much fun as you had doing this, there is some chance you want to do this automatically in the future. Just add this line:

usbserial vendor=0x4348 product=0x5523

to /etc/modules with the vendor and product numbers you found. Of course you must user sudo to edit that file.


Related

Wiki: how_to

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.