diff options
| -rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index e32709e0dd65..721fdb3597ca 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
| @@ -304,6 +304,45 @@ static int e2i_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
| 304 | #define EGALAX_PKT_TYPE_REPT 0x80 | 304 | #define EGALAX_PKT_TYPE_REPT 0x80 |
| 305 | #define EGALAX_PKT_TYPE_DIAG 0x0A | 305 | #define EGALAX_PKT_TYPE_DIAG 0x0A |
| 306 | 306 | ||
| 307 | static int egalax_init(struct usbtouch_usb *usbtouch) | ||
| 308 | { | ||
| 309 | int ret, i; | ||
| 310 | unsigned char *buf; | ||
| 311 | struct usb_device *udev = interface_to_usbdev(usbtouch->interface); | ||
| 312 | |||
| 313 | /* | ||
| 314 | * An eGalax diagnostic packet kicks the device into using the right | ||
| 315 | * protocol. We send a "check active" packet. The response will be | ||
| 316 | * read later and ignored. | ||
| 317 | */ | ||
| 318 | |||
| 319 | buf = kmalloc(3, GFP_KERNEL); | ||
| 320 | if (!buf) | ||
| 321 | return -ENOMEM; | ||
| 322 | |||
| 323 | buf[0] = EGALAX_PKT_TYPE_DIAG; | ||
| 324 | buf[1] = 1; /* length */ | ||
| 325 | buf[2] = 'A'; /* command - check active */ | ||
| 326 | |||
| 327 | for (i = 0; i < 3; i++) { | ||
| 328 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
| 329 | 0, | ||
| 330 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
| 331 | 0, 0, buf, 3, | ||
| 332 | USB_CTRL_SET_TIMEOUT); | ||
| 333 | if (ret >= 0) { | ||
| 334 | ret = 0; | ||
| 335 | break; | ||
| 336 | } | ||
| 337 | if (ret != -EPIPE) | ||
| 338 | break; | ||
| 339 | } | ||
| 340 | |||
| 341 | kfree(buf); | ||
| 342 | |||
| 343 | return ret; | ||
| 344 | } | ||
| 345 | |||
| 307 | static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | 346 | static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
| 308 | { | 347 | { |
| 309 | if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT) | 348 | if ((pkt[0] & EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT) |
| @@ -1056,6 +1095,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
| 1056 | .process_pkt = usbtouch_process_multi, | 1095 | .process_pkt = usbtouch_process_multi, |
| 1057 | .get_pkt_len = egalax_get_pkt_len, | 1096 | .get_pkt_len = egalax_get_pkt_len, |
| 1058 | .read_data = egalax_read_data, | 1097 | .read_data = egalax_read_data, |
| 1098 | .init = egalax_init, | ||
| 1059 | }, | 1099 | }, |
| 1060 | #endif | 1100 | #endif |
| 1061 | 1101 | ||
