| int sendevent_main(int argc, char *argv[]) |
| struct input_event event; |
| fprintf(stderr, "use: %s device type code value\n", argv[0]); |
| fd = open(argv[1], O_RDWR); |
| fprintf(stderr, "could not open %s, %s\n", argv[optind], strerror(errno)); |
| if (ioctl(fd, EVIOCGVERSION, &version)) { |
| fprintf(stderr, "could not get driver version for %s, %s\n", argv[optind], strerror(errno)); |
| memset(&event, 0, sizeof(event)); |
| event.type = atoi(argv[2]); |
| event.code = atoi(argv[3]); |
| event.value = atoi(argv[4]); |
| ret = write(fd, &event, sizeof(event)); |
| if(ret < (ssize_t) sizeof(event)) { |
| fprintf(stderr, "write event failed, %s\n", strerror(errno)); |