How to activate multitouch USB device?

I am making my first Linux USB device driver and I am trying to connect a touchpad device.

I tried this device in Win7 using the default Win7 touchpad driver. Using a line monitor / reader, I was able to get raw data using multi-touch ENABLED . Say, for example, for a data array with multiple touches [0x8301] and [0x8701] for the first and second touches, respectively.

Now using multi-touch DISABLED, the raw data header will be [0x8101]

Now with the driver I made for Linux, I can only get it for output [0x8101] , which is a one-touch data header.

So, I guess, somewhere in this part of the initialization code, I have to say that this is a device with a few touches. Or I'm probably initializing it incorrectly.

struct input_dev *input_dev; input_dev = input_allocate_device(); input_dev->name = usb_mtouch->name; input_dev->phys = usb_mtouch->phys; usb_to_input_id(usb_mtouch->udev, &input_dev->id); input_dev->dev.parent = &interface->dev; input_set_drvdata(input_dev, usb_mtouch); input_dev->open = mtouchdrv_open; input_dev->close = mtouchdrv_close; input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_TOUCH) | BIT_MASK(BTN_STYLUS); input_set_abs_params(input_dev, ABS_X, usb_mtouch->x_min, usb_mtouch->x_max, 0, 0); input_set_abs_params(input_dev, ABS_Y, usb_mtouch->y_min, usb_mtouch->y_max, 0, 0); input_set_abs_params(input_dev, ABS_PRESSURE, 0, usb_mtouch->press_max, 0, 0); input_dev->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); 

In addition, I am using Linux 2.6.24.

Thanks!

Naze

+4
source share
1 answer

I understood. You will need to send a control message to the device.

 int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout) 

Most devices have one-touch enabled by default. Therefore, sending a message to the device will do the trick.

The tricky part is sending a message. Since Win7 can make it one touch or multi-touch. What I did is simply compare the initialization sequence on both. And apply the β€œmissing” messages on Linux.

+3
source

All Articles