Compile from source USB-to-Serial drivers on CentOS7

Compiling USB drivers for serial adapters running on Linux

Compile from source USB-to-Serial drivers on CentOS7
Photo by Jess Bailey / Unsplash

I ran into an issue recently migrating to Cent0S 7 as my primary workstation. In Windows my Raspberry Pis happily conversed with my workstation of puTTY using a USB-to-Serial connector from AdaFruit. This was great, allowing me to program without hooking up a monitor of HDMI for console access. However, despite all the statements of the connector seamlessly working on Linux, it did not, issuing errors like 'serial connection unable to establish'.

Suspecting a driver issue, I began looking for the chipset. According the AdaFruit, the chipset had changed a number of times for this particular connector.

AdaFruit Product Details

This lead me to SiLabs where I found the latest driver of the current chipset

SiLabs Software Downloads

From this page I was able to download the proper software for my kernel (3.x.x) after creating an account (?...what sacrifices). Anyway, once I sold my soul, I managed to get the files downloaded to start the REAL fun.

Lets do this!

Now for the exciting part...ok...more exciting than pouring over forums and websites...

# unzip the DL

[Downloads]$ unzip Linux-3-x-x-VCP-Driver-Source.zip 
Archive:  Linux-3-x-x-VCP-Driver-Source.zip
creating: Linux_3.x.x_VCP_Driver_Source/
inflating: Linux_3.x.x_VCP_Driver_Source/cp210x.c  
creating: __MACOSX/
creating: __MACOSX/Linux_3.x.x_VCP_Driver_Source/
inflating: __MACOSX/Linux_3.x.x_VCP_Driver_Source/._cp210x.c  
inflating: Linux_3.x.x_VCP_Driver_Source/cp210x_gpio_example.c  
inflating: __MACOSX/Linux_3.x.x_VCP_Driver_Source/._cp210x_gpio_example.c  
inflating: Linux_3.x.x_VCP_Driver_Source/CP210x_VCP_Linux_3.13.x_Release_Notes.txt 
inflating: __MACOSX/Linux_3.x.x_VCP_Driver_Source/._CP210x_VCP_Linux_3.13.x_Release_Notes.txt  
inflating: Linux_3.x.x_VCP_Driver_Source/Makefile  
inflating: __MACOSX/Linux_3.x.x_VCP_Driver_Source/._Makefile
inflating: __MACOSX/._Linux_3.x.x_VCP_Driver_Source
		
# cd to the source...ignore that MAC stuff...
		
[Downloads]$ ls
Linux_3.x.x_VCP_Driver_Source  __MACOSX
		
[Downloads]$ cd Linux_3.x.x_VCP_Driver_Source
		
[Linux_3.x.x_VCP_Driver_Source]$ ls
cp210x.c  cp210x_gpio_example.c CP210x_VCP_Linux_3.13.x_Release_Notes.txt  Makefile
		
# make stuff happen...
		
[Linux_3.x.x_VCP_Driver_Source]$ make 
make -C /lib/modules/3.10.0-514.26.2.el7.x86_64/build M=/home/xiphos/Downloads/Linux_3.x.x_VCP_Driver_Source modules
make[1]: Entering directory `/usr/src/kernels/3.10.0-514.26.2.el7.x86_64'
CC [M]  /home/workstation/Downloads/Linux_3.x.x_VCP_Driver_Source/cp210x.o
Building modules, stage 2.
MODPOST 1 modules
CC      /home/workstation/Downloads/Linux_3.x.x_VCP_Driver_Source/cp210x.mod.o
LD [M]  /home/workstation/Downloads/Linux_3.x.x_VCP_Driver_Source/cp210x.ko
make[1]: Leaving directory `/usr/src/kernels/3.10.0-514.26.2.el7.x86_64'

[Linux_3.x.x_VCP_Driver_Source]$ ls
		 cp210x.c
		 cp210x.ko
		 cp210x.mod.o
		 CP210x_VCP_Linux_3.13.x_Release_Notes.txt
		 modules.order
		 cp210x_gpio_example.c
		 cp210x.mod.c
		 cp210x.o
		 Makefile
		 Module.symvers
		
# move compiled drivers where they need to go...
		
[Linux_3.x.x_VCP_Driver_Source]$ sudo cp cp210x.ko /lib/modules/3.10.0-514.26.2.el7.x86_64/kernel/drivers/usb/serial

######################################################################
# This next part hung me up because the Release notes clearly state    # needing to insmod a usbserial.ko module (insert into kernel). This is # hard because that module doesn't exist in CentOS7...so I just skipped # it and insmod'ed the driver :)
####################################################################		
[Linux_3.x.x_VCP_Driver_Source]$ insmod /lib/modules/3.10.0-514.26.2.el7.x86_64/kernel/drivers/usb/serial/cp210x.ko
		
[Linux_3.x.x_VCP_Driver_Source]$ sudo chmod 666 /dev/ttyUSB0
		
# if you have a ttyUSB1, chmod it as well

$ sudo chmod 777 /dev/ttyUSB1		

...and with that, I was able to establish a PuTTY serial session between my CentOS7 and Raspberry Pi. Now, so can you!

Subscribe to Warybyte

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe