Re: [PATCH] NEXIO (or iNexio) support for usbtouchscreen

Oliver Neukum
2009-11-17T15:25:32Z

Am Montag, 16. November 2009 15:14:59 schrieb Ondrej Zary:

Hi,

firstly can you please send patches with -up? It makes them more readable.
> ---

> @@ -92,7 +95,7 @@
> dma_addr_t data_dma;
> unsigned char *buffer;
> int buf_len;
> - struct urb *irq;
> + struct urb *irq, *ack;

Where is this urb handled in case of disconnection?

> +#ifdef CONFIG_TOUCHSCREEN_USB_NEXIO
> + /* ignore the comm interface */
> + {USB_DEVICE_AND_INTERFACE_INFO(0x10f0, 0x2002, 0x02, 0x02, 0x00),
> + .driver_info = DEVTYPE_IGNORE},
> + {USB_DEVICE_AND_INTERFACE_INFO(0x1870, 0x0001, 0x02, 0x02, 0x00),
> + .driver_info = DEVTYPE_IGNORE},
> + /* normal device IDs */
> + {USB_DEVICE(0x10f0, 0x2002), .driver_info = DEVTYPE_NEXIO},
> + {USB_DEVICE(0x1870, 0x0001), .driver_info = DEVTYPE_NEXIO},

Why not go for the interfaces you want?

> +static unsigned char nexio_ack[2] = { 0xaa, 0x02 };
> +
> +static int nexio_init(struct usbtouch_usb *usbtouch)
> +{
> + struct usb_device *dev = usbtouch->udev;
> + int ret = -ENOMEM;
> + int actual_len;
> + unsigned char *buf;
> + unsigned char init[4] = { 0x82, 0x04, 0x0a, 0x0f };
> + char *firmware_ver;
> +
> + buf = kmalloc(NEXIO_BUFSIZE, GFP_KERNEL);
> + if (!buf)
> + goto err_nobuf;
> + /* two reads */
> + ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, NEXIO_INPUT_EP), buf,
> + NEXIO_BUFSIZE, &actual_len, NEXIO_TIMEOUT);
> + if (ret < 0)
> + goto err_out;
> + ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, NEXIO_INPUT_EP), buf,
> + NEXIO_BUFSIZE, &actual_len, NEXIO_TIMEOUT);
> + if (ret < 0)
> + goto err_out;
> + /* send init command */
> + ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, NEXIO_OUTPUT_EP), init,
> + sizeof(init), &actual_len, NEXIO_TIMEOUT);

DMA on the kernel stack

Regards
Oliver