Rev 117 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 117 | Rev 125 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | #include <confuse.h> |
|
- | 2 | #include <string.h> |
|
- | 3 | ||
1 | #include <stdio.h> |
4 | #include <stdio.h> |
2 | #include <stdlib.h> |
5 | #include <stdlib.h> |
3 | #include <string.h> |
6 | #include <string.h> |
4 | #include <fcntl.h> |
7 | #include <fcntl.h> |
5 | #include "lib/x52/x52.h" |
8 | #include "lib/x52/x52.h" |
Line 72... | Line 75... | ||
72 | #define INPUT_NONE 0 |
75 | #define INPUT_NONE 0 |
73 | #define INPUT_JOYDEV 1 |
76 | #define INPUT_JOYDEV 1 |
74 | #define INPUT_EVDEV 2 |
77 | #define INPUT_EVDEV 2 |
Line -... | Line 78... | ||
- | 78 | ||
- | 79 | ||
- | 80 | // from config |
|
75 | 81 | char *input_evdev_name; |
|
76 | 82 | ||
77 | // time struct for measuring |
83 | // time struct for measuring |
Line 178... | Line 184... | ||
178 | struct input_event ev[64]; /* the events (up to 64 at once) */ |
184 | struct input_event ev[64]; /* the events (up to 64 at once) */ |
Line 179... | Line 185... | ||
179 | 185 | ||
180 | int evdev_fd; |
186 | int evdev_fd; |
181 | int connect_evdev() |
187 | int connect_evdev() |
182 | { |
188 | { |
183 | if ((evdev_fd = open("/dev/input/event10", O_RDONLY)) < 0) { |
189 | if ((evdev_fd = open(input_evdev_name, O_RDONLY)) < 0) { |
184 | printf(" cant open evdev "); |
190 | printf(" cant open evdev "); |
185 | return 0; |
191 | return 0; |
Line 186... | Line 192... | ||
186 | } |
192 | } |
Line 373... | Line 379... | ||
373 | int connected=0; |
379 | int connected=0; |
Line 374... | Line 380... | ||
374 | 380 | ||
Line -... | Line 381... | ||
- | 381 | ||
375 | 382 | int input=INPUT_NONE; |
|
376 | int input=INPUT_NONE; |
383 | |
- | 384 | ||
377 | 385 | int main(int argc, char**argv) |
|
378 | int main(int argc, char**argv) |
386 | { |
- | 387 | ||
379 | { |
388 | printf("Starting Riddim \n"); |
- | 389 | printf("\tRemote Interactive Digital Drone Interface Mashup\n"); |
|
- | 390 | ||
- | 391 | ||
- | 392 | ||
- | 393 | cfg_opt_t opts[] = { |
|
- | 394 | CFG_SIMPLE_STR("input_evdev", &input_evdev_name), |
|
- | 395 | CFG_END() |
|
- | 396 | }; |
|
- | 397 | ||
- | 398 | cfg_t *cfg; |
|
- | 399 | ||
- | 400 | // input_evdev_name=strdup("/dev/event0"); |
|
- | 401 | printf("Parsing config file"); |
|
- | 402 | ||
- | 403 | cfg = cfg_init(opts, 0); |
|
380 | printf("Starting Riddim \n"); |
404 | cfg_parse(cfg, "/etc/riddim.conf"); |
381 | printf("\tRemote Interactive Digital Drone Interface Mashup\n"); |
405 | printf("input %s:",input_evdev_name); |
382 | 406 | ||
383 | // 1st argument -> Bluetooth adrees to bypass scanning ( takes to long for short testing roundtrips ) |
407 | // 1st argument -> Bluetooth adrees to bypass scanning ( takes to long for short testing roundtrips ) |
384 | if (argv[1]) |
408 | if (argv[1]) |
Line 405... | Line 429... | ||
405 | input=INPUT_JOYDEV; |
429 | input=INPUT_JOYDEV; |
406 | } |
430 | } |
407 | else |
431 | else |
408 | printf(".. ERROR ");// |
432 | printf(".. ERROR ");// |
Line 409... | Line 433... | ||
409 | 433 | ||
410 | /* printf("\nInitializing evdev input ..\n"); |
434 | printf("\nInitializing evdev input (%s) ..\n",input_evdev_name); |
411 | if (connect_evdev()) |
435 | if (connect_evdev()) |
412 | { |
436 | { |
413 | printf(".. done");// |
437 | printf(".. done");// |
414 | input=INPUT_EVDEV; |
438 | input=INPUT_EVDEV; |
415 | } |
439 | } |
416 | else |
440 | else |
417 | printf(".. ERROR ");// |
441 | printf(".. ERROR ");// |
418 | */ |
442 | |
Line 419... | Line 443... | ||
419 | printf("\nInitializing X-52 output .."); |
443 | printf("\nInitializing X-52 output .."); |
Line 420... | Line 444... | ||
420 | 444 |