Re: [PATCH V3 4/6] USB: serial: f81232: Add F81534A support

From: Johan Hovold
Date: Tue Feb 25 2020 - 06:13:40 EST


On Thu, Jan 30, 2020 at 01:47:50PM +0800, Ji-Ze Hong (Peter Hong) wrote:
> The Fintek F81532A/534A/535/536 is USB-to-2/4/8/12 serial ports device
> and the serial port is default disabled when plugin computer.
>
> The IC is contains devices as following:
> 1. HUB (all devices is connected with this hub)
> 2. GPIO/Control device. (enable serial port and control GPIOs)
> 3. serial port 1 to x (2/4/8/12)
>
> It's most same with F81232, the UART device is difference as follow:
> 1. TX/RX bulk size is 128/512bytes
> 2. RX bulk layout change:
> F81232: [LSR(1Byte)+DATA(1Byte)][LSR(1Byte)+DATA(1Byte)]...
> F81534A:[LEN][Data.....][LSR]
>
> Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@xxxxxxxxx>

> +static void f81534a_process_read_urb(struct urb *urb)
> +{
> + struct usb_serial_port *port = urb->context;
> + unsigned char *data = urb->transfer_buffer;
> + char tty_flag;
> + unsigned int i;
> + u8 lsr;
> + u8 len;
> +
> + if (urb->actual_length < 3) {
> + dev_err(&port->dev, "short message received: %d\n",
> + urb->actual_length);
> + return;
> + }
> +
> + len = data[0];
> + if (len != urb->actual_length) {
> + dev_err(&port->dev, "unexpected length: %d %d\n", len,
> + urb->actual_length);
> + return;

I rephrased this as

dev_err(&port->dev, "malformed message received: %d (%d)\n",
urb->actual_length, len);

before applying.

Johan