Lines Matching refs:ev

159 static int uhid_write(int fd, const struct uhid_event *ev)  in uhid_write()  argument
163 ret = write(fd, ev, sizeof(*ev)); in uhid_write()
167 } else if (ret != sizeof(*ev)) { in uhid_write()
169 ret, sizeof(ev)); in uhid_write()
178 struct uhid_event ev; in create() local
180 memset(&ev, 0, sizeof(ev)); in create()
181 ev.type = UHID_CREATE; in create()
182 strcpy((char*)ev.u.create.name, "test-uhid-device"); in create()
183 ev.u.create.rd_data = rdesc; in create()
184 ev.u.create.rd_size = sizeof(rdesc); in create()
185 ev.u.create.bus = BUS_USB; in create()
186 ev.u.create.vendor = 0x15d9; in create()
187 ev.u.create.product = 0x0a37; in create()
188 ev.u.create.version = 0; in create()
189 ev.u.create.country = 0; in create()
191 return uhid_write(fd, &ev); in create()
196 struct uhid_event ev; in destroy() local
198 memset(&ev, 0, sizeof(ev)); in destroy()
199 ev.type = UHID_DESTROY; in destroy()
201 uhid_write(fd, &ev); in destroy()
208 static void handle_output(struct uhid_event *ev) in handle_output() argument
211 if (ev->u.output.rtype != UHID_OUTPUT_REPORT) in handle_output()
214 if (ev->u.output.size != 2) in handle_output()
217 if (ev->u.output.data[0] != 0x2) in handle_output()
222 ev->u.output.data[1]); in handle_output()
227 struct uhid_event ev; in event() local
230 memset(&ev, 0, sizeof(ev)); in event()
231 ret = read(fd, &ev, sizeof(ev)); in event()
238 } else if (ret != sizeof(ev)) { in event()
240 ret, sizeof(ev)); in event()
244 switch (ev.type) { in event()
259 handle_output(&ev); in event()
265 fprintf(stderr, "Invalid event from uhid-dev: %u\n", ev.type); in event()
280 struct uhid_event ev; in send_event() local
282 memset(&ev, 0, sizeof(ev)); in send_event()
283 ev.type = UHID_INPUT; in send_event()
284 ev.u.input.size = 5; in send_event()
286 ev.u.input.data[0] = 0x1; in send_event()
288 ev.u.input.data[1] |= 0x1; in send_event()
290 ev.u.input.data[1] |= 0x2; in send_event()
292 ev.u.input.data[1] |= 0x4; in send_event()
294 ev.u.input.data[2] = abs_hor; in send_event()
295 ev.u.input.data[3] = abs_ver; in send_event()
296 ev.u.input.data[4] = wheel; in send_event()
298 return uhid_write(fd, &ev); in send_event()