1 #include <stdlib.h>
2 #include <stdint.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <stdbool.h>
6 
7 #include <arcan_shmif.h>
8 
main(int argc,char ** argv)9 int main(int argc, char** argv)
10 {
11 	struct arcan_shmif_cont cont = arcan_shmif_open_ext(
12 		SHMIF_ACQUIRE_FATALFAIL, NULL, (struct shmif_open_ext )
13 		{.type = SEGID_SENSOR}, sizeof(struct shmif_open_ext)
14 	);
15 
16 /* Need to push the first signal for all the server-side
17  * resources to be setup-/ allocated-. */
18 	arcan_shmif_signal(&cont, SHMIF_SIGVID);
19 	printf("connected\n");
20 
21 	int id = 0;
22 	while (-1 < arcan_shmif_enqueue(&cont,
23 		&(struct arcan_event){
24 			.category = EVENT_IO,
25 			.io = {
26 				.devid = 1,
27 				.subid = rand() % 256,
28 				.kind = EVENT_IO_BUTTON,
29 				.datatype = EVENT_IDATATYPE_TRANSLATED,
30 				.devkind = EVENT_IDEVKIND_KEYBOARD,
31 				.input.translated = {
32 					.scancode = rand() % 256,
33 					.active = rand() % 2 == 0,
34 					.utf8 = {'a' + rand() %10}
35 				}
36 			}
37 		})){
38 	}
39 
40 	printf("enqueue failed\n");
41 
42 	return EXIT_SUCCESS;
43 }
44