/*****************************************************************************
* AMT 6000 part , add by willow 2011.4.13
*/
#ifdef CONFIG_TOUCHSCREEN_USB_AMT_6000
static int amt_6000_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{
dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1] ;
dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3] ;
dev->touch = (pkt[0] & 0x40) >> 6;
return 1;
}
#endif
/*****************************************************************************
* IdealTEK URTC1000 Part
*/
#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
#ifndef MULTI_PACKET
#define MULTI_PACKET
#endif
static int idealtek_get_pkt_len(unsigned char *buf, int len)
{
if (buf[0] & 0x80)
return 5;
if (buf[0] == 0x01)
return len;
return 0;
}
static int idealtek_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{
switch (pkt[0] & 0x98) {
case 0x88:
/* touch data in IdealTEK mode */
dev->x = (pkt[1] << 5) | (pkt[2] >> 2);
dev->y = (pkt[3] << 5) | (pkt[4] >> 2);
dev->touch = (pkt[0] & 0x40) ? 1 : 0;
return 1;
case 0x98:
/* touch data in MT emulation mode */
dev->x = (pkt[2] << 5) | (pkt[1] >> 2);
dev->y = (pkt[4] << 5) | (pkt[3] >> 2);
dev->touch = (pkt[0] & 0x40) ? 1 : 0;
return 1;
default:
return 0;
}
}
#endif
/*****************************************************************************
* General Touch Part
*/
#ifdef CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH
static int general_touch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{
dev->x = ((pkt[2] & 0x0F) << 8) | pkt[1] ;
dev->y = ((pkt[4] & 0x0F) << 8) | pkt[3] ;
dev->press = pkt[5] & 0xff;
dev->touch = pkt[0] & 0x01;
return 1;
}
#endif
/*****************************************************************************
* GoTop Part
*/
#ifdef CONFIG_TOUCHSCREEN_USB_GOTOP
static int gotop_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{
dev->x = ((pkt[1] & 0x38) << 4) | pkt[2];
dev->y = ((pkt[1] & 0x07) << 7) | pkt[3];
dev->touch = pkt[0] & 0x01;
return 1;
}
#endif
/*****************************************************************************
* JASTEC Part
*/
#ifdef CONFIG_TOUCHSCREEN_USB_JASTEC
static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{
dev->x = ((pkt[0] & 0x3f) << 6) | (pkt[2] & 0x3f);
dev->y = ((pkt[1] & 0x3f) << 6) | (pkt[3] & 0x3f);
dev->touch = (pkt[0] & 0x40) >> 6;
return 1;
}
#endif
/*****************************************************************************
* Zytronic Part
*/
#ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC
static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
{
switch (pkt[0]) {
case 0x3A: /* command response */
dbg("%s: Command response %d", __func__, pkt[1]);
break;
case 0xC0: /* down */
dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7);
dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7);
dev->touch = 1;
dbg("%s: down %d,%d", __func__, dev->x, dev->y);
return 1;