Transplant tslib library error

Transplant tslib library, an error message may appear " the Selected Device Touchscreen IS Nota the I Understand"

 

Why is this so? The reason is very simple: input system and kernel input system version tslib does not match, of course, there are other reasons, but this is the most common case, first analyze tslib the code, observe these words are printed know under what circumstances.

 

The library tslib c and H files join SourceInsight, tracking the source found that there is such a code in the input-raw.c file:
sta tic int check_fd(structtslib_input *i)
{
struct tsdev *ts =i->module.dev;
int version;
u_int32_t bit;
u_int64_t absbit;

 

IF (!((ioctl(ts->fd, EVIOCGVERSION, &version) >= 0) &&
(version ==EV_VERSION) &&
(ioctl(ts->fd,EVIOCGBIT(0, sizeof(bit) * 8), &bit) >= 0) &&
(bit & (1<< EV_ABS)) &&
(ioctl(ts->fd,EVIOCGBIT(EV_ABS, sizeof(absbit) * 8), &absbit) >= 0) &&
(absbit & (1<< ABS_X)) &&
(absbit & (1<< ABS_Y)) && (absbit & (1 << ABS_PRESSURE)))) {
fprintf(stderr,"selected device is not a touchscreen I understand\n");
return -1;
}
if (bit & (1<< EV_SYN))
i->using_syn =1;
return 0;
}

 

The key is the version == EV_VERSION this judgment statement, maybe if unequal, it will print out the selected device is not a touchscreen I understand .

 

input tslib version number is specified in the cross-compile time, assigned to the version, and EV_VERSION is defined in the kernel, when I do tslib, with the 2.6.39 kernel, this EV_VERSION defined in the linux source code include / linux / input.h, the value of 0x010001 , and tslib the version is the same and the cross-compiler, see the compiler, in the / usr / local / the ARM /4.3.2/arm-none-linux-gnueabi/libc/usr/include /linux/input.h, the value of 0x010000 , maybe obviously not equal, of course, does not meet the version == EV_VERSION, resulting in an error.

 

So, here are two solutions

 

1. The source code of the kernel include / linux / input.h in
#define EV_VERSION0x010001
Read:
#define EV_VERSION0x010000

 

2 The arm-none-linux-gnueabi arm cross compiler tool library header files / libc / usr / include /
linux / input.h in
#define EV_VERSION0x010000
Changed
#define EV_VERSION0x010001
And then compile the library tslib

 

When the first general problem can be solved, therefore, appear above case, the first not to rush to change the version, if the two versions are not equal, a change can,  provided that they are the same version  .

Guess you like

Origin www.cnblogs.com/nanqiang/p/11275389.html