EETI eGalaxTouch serial touchscreen driver, inputattach patch
Subsystems (2)
PATCH 1/1 EETI eGalaxTouch serial touchscreen driver, inputattach patch
Hi,
I have implemented the serial version of the EETI eGalaxTouch touchscreen driver today using the Hampshire driver as a template.
I have also patched inputattach in linuxconsoletools 1.4.8 to initialize and recognize the device.
I tested it with kernel 4.2.6 and Xorg 1.16.4 and xinput_calibrate with a stylus.
# inputattach -eeti /dev/ttyS3 EETI eGalaxTouch firmware: 1.13.3.HM-EX EETI eGalaxTouch controller type: C8051F320
# dmesg | tail -f ... [ 48.381613] serio: Serial port ttyS3 [ 48.388445] input: EETI eGalaxTouch Serial TouchScreen as /devices/pnp0/00:06/tty/ttyS3/serio1/input/input9
Attached both the kernel module patch and the linuxconsoletools patch. Can someone review these patches, please?
The kernel patch is
No idea if the linuxconsoletools patch needs the annotation or not.
I also noticed that inputattach does not support SERIO_HAMPSHIRE which was also added as a template in the patch. Another note about inputattach.c in linuxconsoletools that it has #ifdef SERIO_TSC40 ... #endif and SERIO_TSC40 is smaller, hence, added earlier to the kernel than SERIO_WACOM_IV, for which the support is unconditional. Isn't it a little inconsistent?
Best regards,
Zoltán Böszörményi
utils/inputattach.c +72 -0
@@ -622,6 +622,68 @@ static int wacom_iv_init(int fd, unsignereturn 0 ; } +static int check_egalax_response (int fd,unsigned char *command,int sz,unsigned char *response) { +int pos =0 ; +int error =0 ; +int rest_length; + +if (write (fd, command, sz) != sz) +return -1 ; + +for (pos =0 ; pos <3 ; pos++) { +if (readchar (fd, &response[pos],100 )) { + error =1 ; +break ; + } + } + +if (error) +return -1 ; + + rest_length = response[1 ] -1 ; + +for (; rest_length; rest_length--, pos++) { +if (readchar (fd, &response[pos],100 )) { + error =1 ; +break ; + } + } + +if (error) +return -1 ; + +if (response[1 ] >= command[1 ] && + response[0 ] == command[0 ] && + response[2 ] == command[2 ]) +return 0 ; + +return -1 ; +} + +static int egalax_init (int fd,unsigned long *id,unsigned long *extra) { +unsigned char packet_alive_query[3 ] = {0x0a ,0x01 ,'A' }; +unsigned char packet_fw_ver[3 ] = {0x0a ,0x01 ,'D' }; +unsigned char packet_ctrl_type[3 ] = {0x0a ,0x01 ,'E' }; +unsigned char response[128 ]; + +if (check_egalax_response (fd, packet_alive_query,sizeof (packet_alive_query), response)) +return -1 ; + +if (check_egalax_response (fd, packet_fw_ver,sizeof (packet_fw_ver), response)) +return -1 ; + + response[(unsigned char )response[1 ] +2 ] ='\0' ; +printf ("EETI eGalaxTouch firmware: %s\n" , &response[3 ]); + +if (check_egalax_response (fd, packet_ctrl_type,sizeof (packet_ctrl_type), response)) +return -1 ; + + response[(unsigned char )response[1 ] +2 ] ='\0' ; +printf ("EETI eGalaxTouch controller type: %s\n" , &response[3 ]); + +return 0 ; +} +struct input_types {const char *name;const char *name2;
@@ -704,6 +766,11 @@ static struct input_types input_types[] {"--twiddler-joy" ,"-twidjoy" ,"Handykey Twiddler used as a joystick" ,B2400 ,CS8 , SERIO_TWIDJOY, 0x00, 0x00, 0, twiddler_init }, +#ifdef SERIO_EGALAX +{ "--eetiegalax", "-eeti", "EETI eGalaxTouch", +B9600 ,CS8 , + SERIO_EGALAX, 0x00, 0x00, 0, egalax_init }, +#endif { "--elotouch", "-elo", "ELO touchscreen, 10-byte mode",B9600 ,CS8 , SERIO_ELO, 0x00, 0x00, 0, NULL },
@@ -716,6 +783,11 @@ static struct input_types input_types[] {"--elo261-280" ,"-elo3b" ,"ELO Touchscreen, 3-byte mode" ,B9600 ,CS8 |CRTSCTS , SERIO_ELO, 0x03, 0x00, 0, NULL }, +#ifdef SERIO_HAMPSHIRE +{ "--hampshire", "-ham", "Hampshire touchscreen", +B9600 ,CS8 , + SERIO_HAMPSHIRE, 0x00, 0x00, 0, NULL }, +#endif { "--mtouch", "-mtouch", "MicroTouch (3M) touchscreen",B9600 ,CS8 |CRTSCTS , SERIO_MICROTOUCH, 0x00, 0x00, 0, NULL },
drivers/input/touchscreen/egalax.c +210 -0
210 lines not on this page · raw message
drivers/input/touchscreen/Kconfig +10 -0
@@ -295,6 +295,16 @@ config TOUCHSCREEN_EGALAX To compile this driver as a module, choose M here: the module will be called egalax_ts. +config TOUCHSCREEN_EGALAX_SERIO + tristate "EETI eGalax serial touchscreen" + select SERIO + help + Say Y here to enable support for serial connected EETI + eGalax touch panels. + + To compile this driver as a module, choose M here: the + module will be called egalax. + config TOUCHSCREEN_FUJITSU tristate "Fujitsu serial touchscreen" select SERIO
drivers/input/touchscreen/Makefile +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ obj-$(CONFIG_TOUCHSCREEN_ELAN) += elants_i2c.o obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o obj-$(CONFIG_TOUCHSCREEN_EGALAX) += egalax_ts.o +obj-$(CONFIG_TOUCHSCREEN_EGALAX_SERIO) += egalax.o obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix.o obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o
include/uapi/linux/serio.h +1 -0
@@ -77,5 +77,6 @@#define SERIO_PS2MULT 0x3c#define SERIO_TSC40 0x3d#define SERIO_WACOM_IV 0x3e +#define SERIO_EGALAX 0x3f#endif /* _UAPI_SERIO_H */