Configuring Sabrent USB-2920

Serial adapter

This guide is based around configuring the Sabrent USB2920 USB to RS232 Serial Adapter on Linux. This is used for applications such as connecting to networking equipment or embedded devices.


1. First we need to see if your kernel has support for cp210x as a module or not yet. You can check with the following if your kernel has support for accessing the config through proc enabled.

modprobe configs
zgrep "USB_SERIAL_CP210X" /proc/config.gz

If your kernel doesn't have accessing the config through proc enabled then the next easiest option would be to see what happens when you try to probe the module. This way we can see if it becomes enabled, if it does we know it's there

modprobe cp210x
lsmod | cut -f 1 -d " " | grep cp210x

2. If you get a result back then you have the module and its now enabled. You should be able to use your device now, so plug it in and do the following

dmesg

You should see something similar to the following occur. Note the last line how udev creates a device in /dev and assigns this USB device to it. This is what you input into programs such as Minicom to use the device

[  989.047171] usb 3-1: new full-speed USB device number 2 using xhci_hcd
[  989.217071] usb 3-1: New USB device found, idVendor=0403, idProduct=6001
[  989.217075] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  989.217077] usb 3-1: Product: FT232R USB UART
[  989.217079] usb 3-1: Manufacturer: FTDI
[  989.217080] usb 3-1: SerialNumber: AE017J6J
[  989.249595] usbcore: registered new interface driver ftdi_sio
[  989.249648] usbserial: USB Serial support registered for FTDI USB Serial Device
[  989.249875] ftdi_sio 3-1:1.0: FTDI USB Serial Device converter detected
[  989.249935] usb 3-1: Detected FT232RL
[  989.250173] usb 3-1: FTDI USB Serial Device converter now attached to ttyUSB0

If this works for you then skip to step 14 as you don't need to follow the middle part of this guide.


3. If the above just completely does not work work for you, you don't get any results back from the greps etc. Then you need to recompile your kernel with support with the following:

USB CP210x family of UART Bridge Controllers

CONFIG_USB_SERIAL_CP210X:

Say Y here if you want to use a CP2101/CP2102/CP2103 based USB
to RS232 converters.

To compile this driver as a module, choose M here: the
module will be called cp210x.

Symbol: USB_SERIAL_CP210X [=m]
Type  : tristate
Prompt: USB CP210x family of UART Bridge Controllers
  Location:
    -> Device Drivers
      -> USB support (USB_SUPPORT [=y])
        -> USB Serial Converter support (USB_SERIAL [=m])
  Defined at drivers/usb/serial/Kconfig:135
  Depends on: USB_SUPPORT [=y] && USB [=m] && USB_SERIAL [=m]

4. Using the information above in step 3 we will recompile your kernel. The first step is to acquire the kernel sources, choose the branch and release you wish to use - a safe bet is using the stable branch as its close to mainline yet stable so it has all the new features, bug fixes, and so forth.

Kernel.org


5. We will now prepare the directory where we will be working with the kernel. Do the following:

mkdir /usr/src/linux-<version-number-here>

Note: Replace with the version number of the kernel you selected. This is optional but will prove useful for your reference later if you ever recompile your kernel, so you know which sources you already have

cd /usr/src/linux-<version-number-here>

6. Right click where it says tar.xz and select copy link location. Paste the link where the following says

wget <insert-link-here>

7. Now we will extract the compressed tar so we can work with the sources.

tar -xf linux-*

After the above command completes do the following to delete the tar as we wont be needing it anymore since we have the extracted kernel sources now

rm -rf linux-*

8. Now that we have the sources extracted and in the correct directory we can begin. Lets get your current kernels configuration so we can work from there and add to it

zcat /proc/config.gz> .config

9. Launch the following to get into the kernel configuration menu so we can add support for the missing module

make menuconfig

10. Lets navigate to where the module we're looking for is, go the following location in the menu and enable the module by pressing M on it while you have it selected.

module location

And once there you're looking for "USB CP210x family of UART Bridge Controllers" press M on it when you find it and then use the right arrow keys to navigate right on the bar and select save. After saving exit out.


11. It's time to compile the kernel now that we've modified the kernels configuration. Do note this will take a while depending on how fast your CPU is and how many cores you allocate to compiling. It could take anywhere from 10 to 30 minutes or more even if your CPU is slow

make

For processors with multiple cores, make all the cores do the work. Add the option -j( + 1). For example, a dual core processor contains two logical cores plus one (2 + 1):

make -j3

A quad core system contains four logical cores plus one (4 + 1):

make -j5

12. After the compilation has finished do the following to install the kernel

If drivers are activated as modules, they must be installed:

make modules_install

The modules will be copied to a sub directory of /lib/modules.

To install the actual kernel:

make install

This command executes /sbin/installkernel, which is part of the sys-apps/debianutils package. The new kernel is installed into /boot/vmlinuz-{version}. If a symbolic link /boot/vmlinuz already exists, it is refreshed by making a link from /boot/vmlinuz to the new kernel, and the previously installed kernel is available as/boot/vmlinuz.old. (installkernel man page). The same for config and System.map files. These symlinks are handy, because they always point to the newest kernel without changing the file path (e.g. they can be used in the bootloader configuration).


13. Now that the kernel is installed you need to refresh your bootloaders configuration so it picks up and uses the new kernel. Depending upon which bootloader you're using this may be different, but I will assume you're using GRUB2. If you're using a different bootloader check your distributions documentation

grub2-mkconfig -o /boot/grub/grub.cfg

14. Next we need to have the module always load as boot so you don't need to probe it whenever you want to use your serial adapter. Do the following with your editor of choice

vi /etc/conf.d/modules

And make sure you create an entry for the cp210x module that looks like the following:

modules="cp210x"

Done! You should now be able to use your USB serial adapter without any issues now


References:

  1. Kernel/Configuration Gentoo documentation

  2. GRUB2 documentation from Gentoo