Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int startDevice(const char *touchdevice) {
- struct uinput_user_dev uidev;
- int fd;
- fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
- if (fd < 0) {
- die("error: open");
- }
- memset(&uidev, 0, sizeof(uidev));
- snprintf(uidev.name, UINPUT_MAX_NAME_SIZE, "%s",touchdevice);
- uidev.id.bustype = 0;
- uidev.id.vendor = 0x0;
- uidev.id.product = 0x0;
- uidev.id.version = 0;
- uidev.absmax[ABS_MT_POSITION_X] = 1280;
- uidev.absmax[ABS_MT_POSITION_Y] = 800;
- if (write(fd, &uidev, sizeof(uidev)) < 0) {
- die("error: write");
- }
- ioctl(fd, UI_SET_EVBIT, EV_ABS);
- ioctl(fd, UI_SET_ABSBIT, ABS_MT_POSITION_X);
- ioctl(fd, UI_SET_ABSBIT, ABS_MT_POSITION_Y);
- ioctl(fd, UI_SET_ABSBIT, ABS_MT_PRESSURE);
- ioctl(fd, UI_SET_ABSBIT, ABS_MT_TOUCH_MAJOR);
- ioctl(fd, UI_SET_ABSBIT, ABS_MT_SLOT);
- ioctl(fd, UI_SET_ABSBIT, ABS_MT_TRACKING_ID);
- ioctl(fd, UI_SET_KEYBIT, BTN_TOUCH);
- if (ioctl(fd, UI_DEV_CREATE, 0) < 0) {
- die("error: ioctl");
- }
- idVirtualTouch = fd;
- return 55;
- }
- touch.deviceType = touchScreen
- touch.internal = 1
- uidev.absmax[ABS_MT_TRACKING_ID] = 65535;
- uidev.absmax[ABS_MT_SLOT] = 9;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement