fir3net
PPS-Firenetbanner-780.5x190-30-03-17

How do I connect to a serial device using a USB-to-Serial Convertor in Linux ?

For years, I had ran my Prolific USB to Serial cable from my Windows 32bit laptop without any issues.

Unfortunately, life when running Windows is never easy. After upgrading Windows 7 to 64bit I tried to install the drivers from CNET downloads.
This was a HUGE mistake. Even though the CNET downloader told me it was downloading at 28K in the background it was installing 8 (yes 8 plugins and other useless crap) onto all my browsers. Finally after cleaning up my machine and finding the drivers from a source not intent in filling my machine full of rubbish I discovered that the drivers fail to work correctly for Windows 7 64bit based platforms. Back to square 1.

After wasting 2 hours trying to get this working in Windows I powered up Linux Mint. Loaded the necessary kernel module and tested. Success ! All in all 20 minutes taken. So high five to Linux and I certainly wont be using CNET downloads again !

So what are the steps ?

Steps

Connect the cable via USB.

Next, run 'lsusb'.

admin@server ~ $ lsusb
Bus 002 Device 002: ID 090c:37a2 Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.)
Bus 005 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Then load the kernel module via the following command. Note : To ensure this survives a reboot append this line to '/etc/modules'

admin@server ~ $ sudo modprobe usbserial vendor=0x067b product=0x2303

You should now see that it is now showing as attached by running 'dmesg'.

admin@server ~ $ dmesg
[  131.747013] USB Serial support registered for pl2303
[  131.747038] pl2303 5-1:1.0: >pl2303 converter detected
[  131.758965] usb 5-1: >pl2303 converter now attached to ttyUSB0

Finally, you will need to connect through to serial device /dev/ttyUSB0. This easiest way to do this is via 'minicom'. Once you have issued the following command it will present you with a menu. Change (within the 'serial port setup' option) the service device to /dev/ttyUSB0 and any other settings i.e baud rate etc. Then select the exit option and you be connected to your serial device.

admin@server ~ $ sudo minicom -s

 

About the Author

RDonato

R Donato

Ricky Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Ricky on Twitter @f3lix001