[AndroidO] [RK3399] -- CH341驱动移植

一.  配置内核编译CH341驱动模块

    配置文件路径: /kernel/arch/arm64/configs/rockchip_defconfig

+CONFIG_USB_SERIAL_CH341=y
+CONFIG_USB_SERIAL_PL2303=y

二.  修改CH341 /dev/ttyUSB* 的节点名称

    修改节点名称为了更方便的使用

diff --git a/kernel/drivers/usb/serial/usb-serial.c b/kernel/drivers/usb/serial/usb-serial.c
index e7e29c7..50f386f 100644
--- a/kernel/drivers/usb/serial/usb-serial.c
+++ b/kernel/drivers/usb/serial/usb-serial.c
@@ -96,7 +96,10 @@ static int allocate_minors(struct usb_serial *serial, int num_ports)
        mutex_lock(&table_lock);
        for (i = 0; i < num_ports; ++i) {
                port = serial->port[i];
-               minor = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL);
+        if(!strcmp(serial->type->description, "ch341-uart"))
+            minor = idr_alloc(&serial_minors, port, 10, 0, GFP_KERNEL);
+        else
+                   minor = idr_alloc(&serial_minors, port, 0, 0, GFP_KERNEL);
                if (minor < 0)
                        goto error;
                port->minor = minor;

    CH341的节点名称修改为/dev/ttyUSB10.

你可能感兴趣的:(AndroidO,RK3399)