//预留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) { 作者: fire 时间: 2017-8-2 14:10
请问楼主使用什么USB转串口芯片呢?ch340可以吗?驱动应该如何安装啊?