The Linux kernel provides an input subsystem, and the input subsystem creates a node of our hardware input device under the/dev/input/path, which in general is named after EVENTXX in our phone, such as event0,event1 and so on, You can take advantage of eviocgname to get this event node name. This is the source point for processing data for the input event in Android.
---------------
The dev/input/event* corresponding device Name can be obtained through the IOCTL command eviocgname.
Instance:
Openinput (const char* inputname) {
int FD =-1;
const char *dirname = "/dev/input";
Char Devname[path_max];
Char *filename;
DIR *dir;
struct Dirent *de;
dir = Opendir (dirname);
if (dir = = NULL)
return-1;
strcpy (Devname, dirname);
filename = devname + strlen (devname);
*filename++ = '/';
while ((de = Readdir (dir))) {
if (de->d_name[0] = = '. ' &&
(de->d_name[1] = = '/' | |
(de->d_name[1] = = '. ' && de->d_name[2] = = ' + ')))
Continue
strcpy (filename, de->d_name);
FD = open (Devname, o_rdonly);
if (fd>=0) {
Char name[80];
if (IOCTL (FD,Eviocgname(sizeof (name)-1), &name) < 1) {
Name[0] = ' + ';
}
if (!strcmp (name, InputName)) {
Break
} else {
Close (FD);
FD =-1;
}
}
}
Closedir (dir);
Loge_if (fd<0, "couldn ' t find '%s ' input device", inputname);
Logi_if (fd>=0, "Found '%s ' input device in%s", InputName, dirname);
return FD;
}
===========================
http://blog.csdn.net/andyhuabing/article/details/7006688
The input subsystem of Linux gets the device Name