两个USB转串口,上电时可以一个固定设置识别为为ttyUSB0,一个固定为ttyUSB1么?

两个USB转串口比如A口和B口,上电启动的时候,可以让A口固定设置识别为为ttyUSB0,B口固定的识别为ttyUSB1么?有办法实现么?

方法:
drivers/usb/serial/usb-serial.c

//根据USB232的USB路径设置定义
+#define DEVPATH_TTYUSB0 “1.4.1”
+#define DEVPATH_TTYUSB1 “1.4.2”
+#define DEVPATH_TTYUSB2 “1.4.3”

@@ -117,6 +116,15 @@ static struct usb_serial *get_free_serial(struct usb_serial *serial,
a= BP_USB_PORT;
#endif

//预留ttyUSB0/1/2

  • // reserved minor 0-2 for build in usb-serial
  • if ((strcmp(serial->dev->devpath, DEVPATH_TTYUSB0) != 0) ||
  •   (strcmp(serial->dev->devpath, DEVPATH_TTYUSB1) != 0) ||
    
  •   (strcmp(serial->dev->devpath, DEVPATH_TTYUSB2) != 0) ){
    
  •   a = 3;
    
  •   dbg("\n%s - not build in usb serail device, minor from = %d\n", __func__, a);
    
  • }
  • for (i = a; i < SERIAL_TTY_MINORS; ++i) {
    if (serial_table[i])
    continue;

@@ -131,7 +139,20 @@ static struct usb_serial *get_free_serial(struct usb_serial *serial,
if (good_spot == 0)
continue;
//检测到USB232设备,分配已经留的设备名

  •   // defined minor 0-2 for build in usb-serial
    
  •   if (strcmp(serial->dev->devpath, DEVPATH_TTYUSB0) == 0) {
    
  •   	i = 0;
    
  •   	dbg("\n%s - devpath = %s, force minor = %d\n", __func__, serial->dev->devpath, i);
    
  •   }else if (strcmp(serial->dev->devpath, DEVPATH_TTYUSB1) == 0) {
    
  •   	i = 1;
    
  •   	dbg("\n%s - devpath = %s, force minor = %d\n", __func__, serial->dev->devpath, i);
    
  •   } else if (strcmp(serial->dev->devpath, DEVPATH_TTYUSB2) == 0) {
    
  •   	i = 2;
    
  •   	dbg("\n%s - devpath = %s, force minor = %d\n", __func__, serial->dev->devpath, i);
    
  •   }
    
  •   *minor = i;
    
  •   j = 0;
      dbg("%s - minor base = %d", __func__, *minor);
      for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
    

请问楼主使用什么USB转串口芯片呢?ch340可以吗?驱动应该如何安装啊?