diff options
-rw-r--r-- | series | 1 | ||||
-rw-r--r-- | usb-serial-add-zte_ev.c-driver.patch | 72 | ||||
-rw-r--r-- | usb-serial-move-usb_serial_debug_data-to-use-ph.patch | 36 |
3 files changed, 75 insertions, 34 deletions
@@ -1,4 +1,5 @@ # My specific stuff, at the top to make it easier to work stuff below. +usb-serial-move-usb_serial_debug_data-to-use-ph.patch xtensa-remove-duplicate-config_hotplug-definition.patch tile-remove-duplicate-config_hotplug-definition.patch config_hotplug-should-be-always-on.patch diff --git a/usb-serial-add-zte_ev.c-driver.patch b/usb-serial-add-zte_ev.c-driver.patch index 62431de6c92ece..c540070f89da75 100644 --- a/usb-serial-add-zte_ev.c-driver.patch +++ b/usb-serial-add-zte_ev.c-driver.patch @@ -3,13 +3,25 @@ From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Date: Fri, 17 Aug 2012 16:59:51 -0700 Subject: [PATCH] USB: serial: add zte_ev.c driver +This adds a driver for the zte_ev set of usb to serial devices. It is +based on a patch floating around the internet that modified the generic +usb-serial driver to only work for this type of device. + +I've left comments in the code that I think show the data commands being +sent to the device, which I'm guessing come from a usb analyzer. Maybe +they can help others out as well. + +Many thanks to nirinA raseliarison for pointing the original patch out +to me, and for testing that the driver works properly. + +Tested-by: nirinA raseliarison <nirina.raseliarison@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/serial/Kconfig | 8 + drivers/usb/serial/Makefile | 1 - drivers/usb/serial/zte_ev.c | 315 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 324 insertions(+) + drivers/usb/serial/zte_ev.c | 307 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 316 insertions(+) --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -37,18 +49,21 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +obj-$(CONFIG_USB_SERIAL_ZTE) += zte_ev.o --- /dev/null +++ b/drivers/usb/serial/zte_ev.c -@@ -0,0 +1,315 @@ +@@ -0,0 +1,307 @@ +/* + * ZTE_EV USB serial driver + * + * Copyright (C) 2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> + * Copyright (C) 2012 Linux Foundation + * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License version -+ * 2 as published by the Free Software Foundation. ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This driver is based on code found in a ZTE_ENV patch that modified ++ * the usb-serial generic driver. Comments were left in that I think ++ * show the commands used to talk to the device, but I am not sure. + */ -+ +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/tty.h> @@ -60,7 +75,14 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +#define MAX_SETUP_DATA_SIZE 32 + -+static int debug; ++static void debug_data(struct device *dev, const char *function, int len, ++ const unsigned char *data, int result) ++{ ++ dev_dbg(dev, "result = %d\n", result); ++ if (result == len) ++ dev_dbg(dev, "%s - length = %d, data = %*ph\n", function, ++ len, len, data); ++} + +static int zte_ev_usb_serial_open(struct tty_struct *tty, + struct usb_serial_port *port) @@ -96,9 +118,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + 0x21, 0xa1, + 0x0000, 0x0000, buf, len, + HZ * USB_CTRL_GET_TIMEOUT); -+ dev_dbg(&port->dev, "result = %d\n", result); -+ if (result == len) -+ usb_serial_debug_data(debug, &port->dev, __func__, len, buf); ++ debug_data(dev, __func__, len, buf, result); + + /* send 3 cmd */ + /* @@ -117,9 +137,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + 0x20, 0x21, + 0x0000, 0x0000, buf, len, + HZ * USB_CTRL_GET_TIMEOUT); -+ dev_dbg(dev, "result = %d\n", result); -+ if (result == len) -+ usb_serial_debug_data(debug, dev, __func__, len, buf); ++ debug_data(dev, __func__, len, buf, result); + + /* send 4 cmd */ + /* @@ -142,9 +160,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + 0x21, 0xa1, + 0x0000, 0x0000, buf, len, + HZ * USB_CTRL_GET_TIMEOUT); -+ dev_dbg(dev, "result = %d\n", result); -+ if (result == len) -+ usb_serial_debug_data(debug, dev, __func__, len, buf); ++ debug_data(dev, __func__, len, buf, result); + + /* send 6 cmd */ + /* @@ -163,9 +179,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + 0x20, 0x21, + 0x0000, 0x0000, buf, len, + HZ * USB_CTRL_GET_TIMEOUT); -+ dev_dbg(dev, "result = %d\n", result); -+ if (result == len) -+ usb_serial_debug_data(debug, dev, __func__, len, buf); ++ debug_data(dev, __func__, len, buf, result); + kfree(buf); + + return usb_serial_generic_open(tty, port); @@ -237,9 +251,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + 0x21, 0xa1, + 0x0000, 0x0000, buf, len, + HZ * USB_CTRL_GET_TIMEOUT); -+ dev_dbg(dev, "result = %d\n", result); -+ if (result == len) -+ usb_serial_debug_data(debug, dev, __func__, len, buf); ++ debug_data(dev, __func__, len, buf, result); + + /* send 4 cmd */ + /* @@ -258,9 +270,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + 0x20, 0x21, + 0x0000, 0x0000, buf, len, + HZ * USB_CTRL_GET_TIMEOUT); -+ dev_dbg(dev, "result = %d\n", result); -+ if (result == len) -+ usb_serial_debug_data(debug, dev, __func__, len, buf); ++ debug_data(dev, __func__, len, buf, result); + + /* send 5 cmd */ + /* @@ -283,9 +293,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + 0x21, 0xa1, + 0x0000, 0x0000, buf, len, + HZ * USB_CTRL_GET_TIMEOUT); -+ dev_dbg(dev, "result = %d\n", result); -+ if (result == len) -+ usb_serial_debug_data(debug, dev, __func__, len, buf); ++ debug_data(dev, __func__, len, buf, result); + + /* send 7 cmd */ + /* @@ -304,9 +312,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + 0x20, 0x21, + 0x0000, 0x0000, buf, len, + HZ * USB_CTRL_GET_TIMEOUT); -+ dev_dbg(dev, "result = %d\n", result); -+ if (result == len) -+ usb_serial_debug_data(debug, dev, __func__, len, buf); ++ debug_data(dev, __func__, len, buf, result); + + /* send 8 cmd */ + /* @@ -351,5 +357,3 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +module_usb_serial_driver(serial_drivers, id_table); +MODULE_LICENSE("GPL v2"); -+ -+ diff --git a/usb-serial-move-usb_serial_debug_data-to-use-ph.patch b/usb-serial-move-usb_serial_debug_data-to-use-ph.patch new file mode 100644 index 00000000000000..af6c1df10b778a --- /dev/null +++ b/usb-serial-move-usb_serial_debug_data-to-use-ph.patch @@ -0,0 +1,36 @@ +From foo@baz Thu Sep 13 09:19:05 PDT 2012 +Date: Thu, 13 Sep 2012 09:19:05 -0700 +To: Greg KH <gregkh@linuxfoundation.org> +From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Subject: USB: serial: move usb_serial_debug_data to use %*ph + +Now that we have a printk modifier for data streams, use it instead of +rolling our own. + +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> + +--- + include/linux/usb/serial.h | 12 +++--------- + 1 file changed, 3 insertions(+), 9 deletions(-) + +--- a/include/linux/usb/serial.h ++++ b/include/linux/usb/serial.h +@@ -360,15 +360,9 @@ static inline void usb_serial_debug_data + const char *function, int size, + const unsigned char *data) + { +- int i; +- +- if (debug) { +- dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", +- function, size); +- for (i = 0; i < size; ++i) +- printk("%.2x ", data[i]); +- printk("\n"); +- } ++ if (debug) ++ dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = %*ph\n", ++ function, size, size, data); + } + + /* Use our own dbg macro */ |