Lines Matching refs:fd
63 static int send_event(int fd, uint16_t type, uint16_t code, int32_t value) in send_event() argument
67 if (fd <= fileno(stderr)) in send_event()
75 return write(fd, &event, sizeof(event)); in send_event()
81 int fd, aux; in uinput_create() local
83 fd = open("/dev/uinput", O_RDWR); in uinput_create()
84 if (fd < 0) { in uinput_create()
85 fd = open("/dev/input/uinput", O_RDWR); in uinput_create()
86 if (fd < 0) { in uinput_create()
87 fd = open("/dev/misc/uinput", O_RDWR); in uinput_create()
88 if (fd < 0) { in uinput_create()
106 if (write(fd, &dev, sizeof(dev)) < 0) { in uinput_create()
109 close(fd); in uinput_create()
114 ioctl(fd, UI_SET_EVBIT, EV_REL); in uinput_create()
117 ioctl(fd, UI_SET_RELBIT, aux); in uinput_create()
121 ioctl(fd, UI_SET_EVBIT, EV_KEY); in uinput_create()
122 ioctl(fd, UI_SET_EVBIT, EV_LED); in uinput_create()
123 ioctl(fd, UI_SET_EVBIT, EV_REP); in uinput_create()
126 ioctl(fd, UI_SET_KEYBIT, aux); in uinput_create()
134 ioctl(fd, UI_SET_EVBIT, EV_KEY); in uinput_create()
137 ioctl(fd, UI_SET_KEYBIT, aux); in uinput_create()
140 ioctl(fd, UI_DEV_CREATE); in uinput_create()
142 return fd; in uinput_create()
183 static void func(int fd) in func() argument
187 static void back(int fd) in back() argument
191 static void next(int fd) in next() argument
195 static void button(int fd, unsigned int button, int is_press) in button() argument
199 send_event(fd, EV_KEY, BTN_LEFT, is_press); in button()
202 send_event(fd, EV_KEY, BTN_RIGHT, is_press); in button()
206 send_event(fd, EV_SYN, SYN_REPORT, 0); in button()
209 static void move(int fd, unsigned int direction) in move() argument
218 send_event(fd, EV_REL, REL_X, x); in move()
219 send_event(fd, EV_REL, REL_Y, y); in move()
221 send_event(fd, EV_SYN, SYN_REPORT, 0); in move()
224 static inline void epox_decode(int fd, unsigned char event) in epox_decode() argument
228 func(fd); break; in epox_decode()
230 back(fd); break; in epox_decode()
232 next(fd); break; in epox_decode()
234 button(fd, 1, 1); break; in epox_decode()
236 button(fd, 1, 0); break; in epox_decode()
240 button(fd, 3, 1); break; in epox_decode()
242 button(fd, 3, 0); break; in epox_decode()
246 move(fd, 0); break; in epox_decode()
248 move(fd, 1); break; in epox_decode()
250 move(fd, 2); break; in epox_decode()
252 move(fd, 3); break; in epox_decode()
254 move(fd, 4); break; in epox_decode()
256 move(fd, 5); break; in epox_decode()
258 move(fd, 6); break; in epox_decode()
260 move(fd, 7); break; in epox_decode()
262 move(fd, 8); break; in epox_decode()
264 move(fd, 9); break; in epox_decode()
266 move(fd, 10); break; in epox_decode()
268 move(fd, 11); break; in epox_decode()
270 move(fd, 12); break; in epox_decode()
272 move(fd, 13); break; in epox_decode()
274 move(fd, 14); break; in epox_decode()
276 move(fd, 15); break; in epox_decode()
292 int i, fd, sk, len; in epox_presenter() local
298 fd = uinput_create("Bluetooth Presenter", 0, 1); in epox_presenter()
299 if (fd < 0) { in epox_presenter()
329 p.fd = sk; in epox_presenter()
342 epox_decode(fd, buf[i]); in epox_presenter()
347 ioctl(fd, UI_DEV_DESTROY); in epox_presenter()
349 close(fd); in epox_presenter()
378 static inline void jthree_decode(int fd, unsigned char event) in jthree_decode() argument
381 send_event(fd, EV_KEY, jthree_keycodes[event & 0x3f], 0); in jthree_decode()
383 send_event(fd, EV_KEY, jthree_keycodes[event - 1], 1); in jthree_decode()
393 int i, fd, sk, len; in jthree_keyboard() local
399 fd = uinput_create("J-Three Keyboard", 1, 0); in jthree_keyboard()
400 if (fd < 0) { in jthree_keyboard()
430 p.fd = sk; in jthree_keyboard()
443 jthree_decode(fd, buf[i]); in jthree_keyboard()
448 ioctl(fd, UI_DEV_DESTROY); in jthree_keyboard()
450 close(fd); in jthree_keyboard()
554 static void celluon_decode(int fd, struct celluon_state *s, uint8_t c) in celluon_decode() argument
583 send_event(fd, EV_KEY, celluon_xlate(s->key), in celluon_decode()
605 int i, fd, sk, len; in celluon_keyboard() local
612 fd = uinput_create("Celluon Keyboard", 1, 0); in celluon_keyboard()
613 if (fd < 0) { in celluon_keyboard()
643 p.fd = sk; in celluon_keyboard()
658 celluon_decode(fd, &s, buf[i]); in celluon_keyboard()
663 ioctl(fd, UI_DEV_DESTROY); in celluon_keyboard()
665 close(fd); in celluon_keyboard()