Identify Input Devices

If you have more than one input device (e.g. two separate event devices only for the power button) you have to identify, which device to use.

By Commandline

# head /proc/bus/input/devices 
I: Bus=0019 Vendor=0000 Product=0001 Version=0000
N: Name="Power Button"
P: Phys=PNP0C0C/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input0
U: Uniq=
H: Handlers=kbd event0 
B: EV=3
B: KEY=10000000000000 0

Source: Stackoverflow

By C-Code

#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <linux/input.h>

int main(int argc, char **argv) {
	int fd;
	char name[256]= "Unknown";
	if ((fd = open(argv[1], O_RDONLY)) < 0) {
		perror("evdev open");
	if(ioctl(fd, EVIOCGNAME(sizeof(name)), name) < 0) {
		perror("evdev ioctl");
	printf("The device on %s says its name is %s\n",
		   argv[1], name);
	return 0;
Source: Using the Input Subsystem, Part II