by David SPORN
(Again, sorry for the poor quality, I was in a hurry. I hope I will do better next time)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
I use Ubuntu 8.04, so the following directive must be adapted to your environnement.
In order to be able to compile the driver, the following packages must be present :
If this is not enough, the following packages might be mandatory (please send me confirmation about that) :
SUBSYSTEM=="usb", ATTRS{idVendor}=="0664", ATTRS{idProduct}=="0306", SYMLINK+="ETandT-$attr{product}"
Extract the files from the archive, then invoke the following command :
The prefix parameter is set to "/usr" so that make install put the driver in the correct location in the case of a standard installation of xorg in /usr.
Normally there must be no problem.
Sudo is mandatory. After that the module is in the right place, ready to be used
In a temp directory, create a file named "dumpDevice.c" with the following content :
#include <stdlib.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <asm/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/hiddev.h>
int main( int argc, char *argv[] ) {
int i;
struct hiddev_event packet;
int fd = -1;
/* requires a file descriptor, so we check we got one, and then open it */
if (argc != 2)
{
fprintf(stderr, "usage: %s hiddevice - probably /dev/usb/hiddev0\n", argv[0]);
exit(1);
}
fd = open(argv[1], O_RDONLY | O_NONBLOCK);
if ((fd = open(argv[1], O_RDONLY)) < 0) {
perror("hiddev open");
exit(1);
}
int data_read ;
unsigned char data ;
for(;;)
{
for(i=0; i<6; i++) {*/
data_read = read(fd, &packet, sizeof(packet)) ;
if (data_read < 0)
{
printf("no data\n");
sleep(50);
break ;
}
printf("%x\t%i\t", packet.hid, packet.value);
}
printf("\n");*/
}
close(fd);
return 0;
}
Compile with gcc -g -Wall -o dumpDevice dumpDevice.c
Then invoke with :
sudo ./dumpDeviceAsync /dev/your_device
Touch the screen and identify the value of interest : which code correspond to the pressure, x position and y position.
For example I obtain the following with the ET&T TC4UM:
d0042 1 d0045 0 d0045 0 d0045 0 10030 1275 10031 1040
d0042 1 d0045 0 d0045 0 d0045 0 10030 1275 10031 1040
d0042 1 d0045 0 d0045 0 d0045 0 10030 1275 10031 1040
d0042 1 d0045 0 d0045 0 d0045 0 10030 1275 10031 1040
d0042 1 d0045 0 d0045 0 d0045 0 10030 1275 10031 1040
d0042 1 d0045 0 d0045 0 d0045 0 10030 1272 10031 1039
d0042 1 d0045 0 d0045 0 d0045 0 10030 1272 10031 1039
d0042 0 d0045 0 d0045 0 d0045 0 10030 1272 10031 1039
d0042 0 d0045 0 d0045 0 d0045 0 10030 1272 10031 1039
d0042 1 d0045 0 d0045 0 d0045 0 10030 1072 10031 1228
d0042 1 d0045 0 d0045 0 d0045 0 10030 1072 10031 1228
d0042 1 d0045 0 d0045 0 d0045 0 10030 1072 10031 1228
d0042 1 d0045 0 d0045 0 d0045 0 10030 1072 10031 1228
d0042 1 d0045 0 d0045 0 d0045 0 10030 1072 10031 1228
d0042 1 d0045 0 d0045 0 d0045 0 10030 1072 10031 1228
d0042 1 d0045 0 d0045 0 d0045 0 10030 1072 10031 1228
Moving my stylus, I find the parameter for the driver (opcode parameter value are converted to decimal values) :
Option "PacketCount" "6"
Option "OpcodePressure" "852034" #d0042
Option "OpcodeX" "65584" #10030
Option "OpcodeY" "65585" #10031
Option "MinX" "89"
Option "MinY" "174"
Option "MaxX" "1846"
Option "MaxY" "1696"
Edit your xorg.conf to add the device. Here is my conf :
Section "InputDevice"
Identifier "ETT Touch Panel"
Driver "hidtouch"
Option "SendCoreEvents"
Option "ReportingMode" "Raw"
Option "Device" "/dev/ETandT-TC4UM"
Option "PacketCount" "6"
Option "OpcodePressure" "852034"
Option "OpcodeX" "65584"
Option "OpcodeY" "65585"
Option "MinX" "89"
Option "MinY" "174"
Option "MaxX" "1846"
Option "MaxY" "1696"
EndSection
...
Section "ServerLayout"
...
InputDevice "ETT Touch Panel" "SendCoreEvents"
...
EndSection
Restart Xorg (Ctrl + Alt + BackSpace) and now the mouse cursor follows your finger and your stylus.