Add parametrs to hide some of converter interfaces against ftdi_sio driver. This allows on multiple-interfaces converter (such as ft2232, ft4232) use uart with kernel driver and use e.g. I2C or SPI (on other interface) with libusb or other kernel-driver. Signed-off-by: Robert Ryszard Paciorek <R.Paciorek@xxxxxxxxxx> --- --- drivers/usb/serial/ftdi_sio.c.org 2012-09-12 10:51:44.779427134 +0000 +++ drivers/usb/serial/ftdi_sio.c 2012-09-12 13:54:40.210930196 +0000 @@ -1633,10 +1633,19 @@ static void remove_sysfs_attrs(struct us * *************************************************************************** */ +/* Module parameter to control ignoring some interfaces on multiple + interfaces converter such as ft2232, ft4232: + ignore_mask - bit mask of ignoring interfaces + ignore_only_on_dev - product name of device with ignore interfaces +*/ +unsigned short ignore_mask; +char *ignore_only_on_dev; + /* Probe function to check for special devices */ static int ftdi_sio_probe(struct usb_serial *serial, const struct usb_device_id *id) { + int i; struct ftdi_sio_quirk *quirk = (struct ftdi_sio_quirk *)id->driver_info; @@ -1646,6 +1655,21 @@ static int ftdi_sio_probe(struct usb_ser return ret; } + if (ignore_mask != 0x00 && (ignore_only_on_dev == NULL + || strcmp(serial->dev->product, ignore_only_on_dev) == 0)) { + struct usb_interface *interface = serial->interface; + struct usb_host_config *actconfig = serial->dev->actconfig; + + for (i = 0; i < 8 && i < USB_MAXINTERFACES; i++) { + if ((ignore_mask>>i) & 0x01 + && interface == actconfig->interface[i]) { + dev_info(&serial->dev->dev, + "Ignoring interface %d\n", i); + return -ENODEV; + } + } + } + usb_set_serial_data(serial, (void *)id->driver_info); return 0; @@ -2440,3 +2464,8 @@ MODULE_PARM_DESC(product, "User specifie module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override"); + +module_param(ignore_mask, ushort, 0); +MODULE_PARM_DESC(ignore_mask, "Bit mask of ignoring interfaces (default=0x0000) (ushort)"); +module_param(ignore_only_on_dev, charp, 0); +MODULE_PARM_DESC(ignore_only_on_dev, "USB product name of device where we ignore interfaces (default NULL == all devices) (string)"); -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html