]> Pileus Git - ~andy/linux/blobdiff - drivers/usb/class/cdc-acm.c
USB: cdc-acm - blacklist IMS PCU device
[~andy/linux] / drivers / usb / class / cdc-acm.c
index 981f2132d1283c44234f4fa79466c4d11241c94e..278bf5256a9596e0b923ecd5a07cfc57362ef68f 100644 (file)
@@ -817,10 +817,6 @@ static const __u32 acm_tty_speed[] = {
        2500000, 3000000, 3500000, 4000000
 };
 
-static const __u8 acm_tty_size[] = {
-       5, 6, 7, 8
-};
-
 static void acm_tty_set_termios(struct tty_struct *tty,
                                                struct ktermios *termios_old)
 {
@@ -834,7 +830,21 @@ static void acm_tty_set_termios(struct tty_struct *tty,
        newline.bParityType = termios->c_cflag & PARENB ?
                                (termios->c_cflag & PARODD ? 1 : 2) +
                                (termios->c_cflag & CMSPAR ? 2 : 0) : 0;
-       newline.bDataBits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4];
+       switch (termios->c_cflag & CSIZE) {
+       case CS5:
+               newline.bDataBits = 5;
+               break;
+       case CS6:
+               newline.bDataBits = 6;
+               break;
+       case CS7:
+               newline.bDataBits = 7;
+               break;
+       case CS8:
+       default:
+               newline.bDataBits = 8;
+               break;
+       }
        /* FIXME: Needs to clear unsupported bits in the termios */
        acm->clocal = ((termios->c_cflag & CLOCAL) != 0);
 
@@ -939,6 +949,10 @@ static int acm_probe(struct usb_interface *intf,
 
        /* normal quirks */
        quirks = (unsigned long)id->driver_info;
+
+       if (quirks == IGNORE_DEVICE)
+               return -ENODEV;
+
        num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR;
 
        /* handle quirks deadly to normal probing*/
@@ -1233,7 +1247,7 @@ made_compressed_probe:
 
                if (usb_endpoint_xfer_int(epwrite))
                        usb_fill_int_urb(snd->urb, usb_dev,
-                               usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress),
+                               usb_sndintpipe(usb_dev, epwrite->bEndpointAddress),
                                NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval);
                else
                        usb_fill_bulk_urb(snd->urb, usb_dev,
@@ -1640,6 +1654,15 @@ static const struct usb_device_id acm_ids[] = {
        .driver_info = NO_DATA_INTERFACE,
        },
 
+#if IS_ENABLED(CONFIG_INPUT_IMS_PCU)
+       { USB_DEVICE(0x04d8, 0x0082),   /* Application mode */
+       .driver_info = IGNORE_DEVICE,
+       },
+       { USB_DEVICE(0x04d8, 0x0083),   /* Bootloader mode */
+       .driver_info = IGNORE_DEVICE,
+       },
+#endif
+
        /* control interfaces without any protocol set */
        { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
                USB_CDC_PROTO_NONE) },