Merge \\"Lose sendevent to toybox.\\" am: 7a8e0c1381
am: 28ccb9a80f
Change-Id: I84e432c6598d66fe41109dd58c8db133ec9852b5
This commit is contained in:
commit
e84b1cc1ea
2 changed files with 0 additions and 43 deletions
|
@ -33,7 +33,6 @@ BSD_TOOLS := \
|
|||
OUR_TOOLS := \
|
||||
getevent \
|
||||
newfs_msdos \
|
||||
sendevent \
|
||||
|
||||
ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/input.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int sendevent_main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
ssize_t ret;
|
||||
int version;
|
||||
struct input_event event;
|
||||
|
||||
if(argc != 5) {
|
||||
fprintf(stderr, "use: %s device type code value\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_RDWR);
|
||||
if(fd < 0) {
|
||||
fprintf(stderr, "could not open %s, %s\n", argv[optind], strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
if (ioctl(fd, EVIOCGVERSION, &version)) {
|
||||
fprintf(stderr, "could not get driver version for %s, %s\n", argv[optind], strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
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));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue