2020年8月

Ubuntu下USB转串口芯片驱动程序安装cp210x,pl2303

Ubuntu下USB转串口芯片驱动程序安装,支持cp210x,pl2303等

Reference: Fixing the cp210x open - Unable to enable UART Error

When you plugin your USB-UART converter, and run "> ls /dev/tty*", if you don't see the /dev/ttyUSB0 (or similar), your Linux does not detect your USB-UART device.

We need to install the driver for your device.

Here we use Ubuntu12.04, and Updated the source to 3.2.0 version. If there is difference about version Number from your OS platform, please try to modify it into yours.

1.Download the Linux Source Code

Open a terminal and execute the following commands. Note that your version of Linux may differ slightly -- adjust accordingly.
$ cd ~
$ sudo apt-get install build-essential linux-source
$ cp /usr/src/linux-source-3.2.0.tar.bz2 .
$ bunzip2 linux-source-3.2.0.tar.bz2
$ tar xf linux-source-3.2.0.tar
$ cd ~/linux-source-3.2.0

https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

2.Chang Pid Vid Recompile and Reinstall the cp210x Driver
(Change Sourcode Pid and Vid to 04C5 142E to fit this mmdvm chip ic driver)
From within a terminal, execute:
$ cd ~/linux-source-3.2.0
$ make oldconfig
$ make prepare
$ make scripts
$ cp /usr/src/linux-headers-3.2.0-34-generic-pae/Module.symvers .

Here, I have the "3.2.0-29" version also, I launched the command above, but not the below:
"cp /usr/src/linux-headers-3.2.0-29-generic-pae/Module.symvers ."

Recompile and Reinstall the cp210x Driver
Here, We can actually install many kinds of USB-UART converter drivers. We take cp210x as the example.
From within a terminal, execute:

$ make M=drivers/usb/serial
$ sudo mv /lib/modules/$(uname -r)/kernel/drivers/usb/serial/cp210x.ko /lib/modules/$(uname -r)/kernel/drivers/usb/serial/cp210x.ko.old
$ sudo cp drivers/usb/serial/cp210x.ko /lib/modules/$(uname -r)/kernel/drivers/usb/serial/
$ sudo modprobe -r cp210x
$ sudo modprobe cp210x

Reboot Linux system.

Run Terminal:
$ ls /dev/tty*
The we can see the device is detected by Linux Host OS:

树莓派读取u盘数据

1.插入u盘查看u盘是否被识别

sudo fdisk -l
2.创建一个目录用于挂载u盘

sudo mkdir /mnt/usb
3.挂载u盘

mount /dev/sda1 /mnt/usb/
/dev/sda1是识别的u盘,不同设备可能不一样

4.进入刚刚创建的usb目录就可以看到u盘里面文件了,可以进行读写操作

5.取消挂载u盘

sudo umount /mnt/usb