Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
127 | ligi | 1 | /************************************************** |
2 | * |
||
3 | * |
||
4 | * Riddim |
||
5 | * Remote Interactive Digital Drone Interface Mashup |
||
6 | * |
||
7 | * 2007-2008 Marcus -LiGi- Bueschleb |
||
8 | * |
||
9 | * |
||
130 | ligi | 10 | **************************************************/ |
125 | ligi | 11 | |
127 | ligi | 12 | #include "riddim.h" |
41 | ligi | 13 | |
14 | |||
127 | ligi | 15 | int state=STATEID_SCANNING; |
41 | ligi | 16 | |
43 | ligi | 17 | |
47 | ligi | 18 | struct js_event x52_event_struct; |
19 | |||
48 | ligi | 20 | int engines_on=0; |
21 | int old_engines_on=0; |
||
22 | |||
130 | ligi | 23 | int *axis; |
24 | char *button; |
||
48 | ligi | 25 | |
127 | ligi | 26 | struct x52 *x52_output; |
47 | ligi | 27 | |
127 | ligi | 28 | int selected_bt_device=0; |
47 | ligi | 29 | |
43 | ligi | 30 | void write_display(int line,char* text) |
31 | { |
||
32 | if (x52_output) x52_settext(x52_output, line , text, strlen(text)); |
||
33 | } |
||
34 | |||
35 | void clear_display() |
||
36 | { |
||
37 | write_display(0,""); |
||
38 | write_display(1,""); |
||
39 | write_display(2,""); |
||
40 | } |
||
41 | |||
42 | |||
43 | void output_device_list() |
||
44 | { |
||
45 | int i; |
||
46 | char disp_txt[20]; |
||
47 | for(i=0;i<bt_device_count;i++) |
||
48 | { |
||
49 | if (i<3) |
||
50 | { |
||
51 | |||
52 | if (selected_bt_device==i) |
||
53 | sprintf(disp_txt,"#%s",names[i]); |
||
54 | else |
||
55 | sprintf(disp_txt," %s",names[i]); |
||
56 | write_display(i,disp_txt); |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | |||
127 | ligi | 61 | |
62 | void print_device_list() |
||
43 | ligi | 63 | { |
127 | ligi | 64 | int i; |
65 | for(i=0;i<bt_device_count;i++) |
||
66 | printf("device%i->%s\n",i,names[i]); |
||
43 | ligi | 67 | } |
68 | |||
69 | |||
130 | ligi | 70 | |
50 | ligi | 71 | int count=0; |
72 | int connected=0; |
||
43 | ligi | 73 | |
117 | ligi | 74 | |
75 | int input=INPUT_NONE; |
||
76 | |||
125 | ligi | 77 | |
483 | ligi | 78 | |
43 | ligi | 79 | int main(int argc, char**argv) |
80 | { |
||
125 | ligi | 81 | |
483 | ligi | 82 | printf("Starting Riddim %d.%d \n",RIDDIM_VERSION_MAJOR,RIDDIM_VERSION_MINOR ); |
43 | ligi | 83 | printf("\tRemote Interactive Digital Drone Interface Mashup\n"); |
127 | ligi | 84 | printf("\nusage:\n"); |
85 | printf("\t riddim [config_file]\n\n"); |
||
125 | ligi | 86 | |
127 | ligi | 87 | |
88 | |||
485 | ligi | 89 | |
483 | ligi | 90 | |
91 | bt_host_init(); |
||
92 | |||
130 | ligi | 93 | if (argv[1]) |
94 | parse_config(argv[1]); |
||
95 | else |
||
96 | parse_config("/etc/riddim.conf"); |
||
125 | ligi | 97 | |
485 | ligi | 98 | |
99 | collect_evdev_devices(); |
||
100 | parse_config_input_sections(); |
||
483 | ligi | 101 | // exit(0); |
125 | ligi | 102 | |
130 | ligi | 103 | printf("input %s:\n",input_evdev_name); |
104 | /* |
||
105 | if (bluetooth_mac) |
||
50 | ligi | 106 | { |
130 | ligi | 107 | |
108 | printf("Connecting via Bluetooth to %s\n",bluetooth_mac); |
||
109 | if (connect_mk_bluetooth(bluetooth_mac));; |
||
110 | connected=TRUE; |
||
127 | ligi | 111 | } |
130 | ligi | 112 | */ |
483 | ligi | 113 | |
114 | if (mk_tty) |
||
115 | { |
||
116 | printf("connecting to mk via tty: %s\n",mk_tty); |
||
117 | if (!connect_mk_tty(mk_tty)) |
||
118 | printf("cant connect !!"); |
||
119 | else |
||
120 | { |
||
121 | printf("connected !-)"); |
||
122 | connected=TRUE; |
||
123 | } |
||
124 | } |
||
125 | |||
127 | ligi | 126 | if (mk_socket_port) |
127 | { |
||
483 | ligi | 128 | printf("connecting to mk via local port: %i\n",mk_socket_port); |
130 | ligi | 129 | |
127 | ligi | 130 | if (connect_mk_localhost_socket(mk_socket_port)==-1) |
131 | printf("cant connect !!"); |
||
132 | else |
||
50 | ligi | 133 | { |
130 | ligi | 134 | printf("connected !-)"); |
127 | ligi | 135 | connected=TRUE; |
50 | ligi | 136 | } |
137 | } |
||
127 | ligi | 138 | |
130 | ligi | 139 | // todo reenable bluetooth connection |
117 | ligi | 140 | |
483 | ligi | 141 | connect_evdev(); |
142 | |||
143 | /* |
||
140 | ligi | 144 | if ((input_evdev_name)) |
117 | ligi | 145 | { |
130 | ligi | 146 | printf("\nInitializing evdev input (%s) ..\n",input_evdev_name); |
147 | |||
148 | if (connect_evdev(input_evdev_name)) |
||
149 | { |
||
150 | printf(".. done");// |
||
151 | input=INPUT_EVDEV; |
||
152 | } |
||
153 | else |
||
154 | printf(".. ERROR ");// |
||
117 | ligi | 155 | } |
483 | ligi | 156 | */ |
140 | ligi | 157 | if (input_joydev_name) |
158 | { |
||
159 | printf("\nInitializing joystick input from %s ..\n",input_joydev_name); |
||
160 | if (connect_joy()) |
||
161 | { |
||
162 | printf(".. done");// |
||
163 | input=INPUT_JOYDEV; |
||
164 | } |
||
165 | else |
||
166 | printf(".. ERROR ");// |
||
167 | } |
||
168 | |||
169 | |||
43 | ligi | 170 | printf("\nInitializing X-52 output .."); |
171 | |||
47 | ligi | 172 | x52_output = x52_init(); |
173 | |||
174 | clear_display(); |
||
43 | ligi | 175 | |
47 | ligi | 176 | write_display(0, "RIDDIM active"); |
43 | ligi | 177 | |
47 | ligi | 178 | if (x52_output) x52_setbri(x52_output, 1,128); |
179 | if (x52_output) |
||
180 | printf(" done \n"); |
||
181 | else |
||
182 | printf(" not found \n"); |
||
43 | ligi | 183 | |
127 | ligi | 184 | /* |
130 | ligi | 185 | if (!connected) |
43 | ligi | 186 | { |
130 | ligi | 187 | printf("Scanning for Bluetooth Devices ..\n"); |
188 | write_display(1,"Bluetooth Scan"); |
||
189 | scan_bt(); |
||
190 | printf(" done \n"); |
||
191 | printf(" %d Devices found \n",bt_device_count); |
||
192 | print_device_list() ; |
||
43 | ligi | 193 | } |
127 | ligi | 194 | */ |
41 | ligi | 195 | |
130 | ligi | 196 | // int v_old; |
117 | ligi | 197 | int polls=0; |
127 | ligi | 198 | |
130 | ligi | 199 | |
127 | ligi | 200 | if (exit_after_init) |
201 | exit(0); |
||
117 | ligi | 202 | printf("starting loop ..\n"); |
203 | |||
204 | |||
130 | ligi | 205 | |
127 | ligi | 206 | int complete_misses=0; |
130 | ligi | 207 | int complete_matches=0; |
117 | ligi | 208 | |
130 | ligi | 209 | |
127 | ligi | 210 | int confirm_misses; |
130 | ligi | 211 | |
212 | |||
213 | |||
483 | ligi | 214 | // init_evdevstatus_led(); |
130 | ligi | 215 | |
216 | while( TRUE ) |
||
41 | ligi | 217 | { |
117 | ligi | 218 | |
483 | ligi | 219 | // blink_evdev_led(); |
220 | bt_host_tick(mk_socket); |
||
127 | ligi | 221 | usleep(loop_delay); |
483 | ligi | 222 | |
223 | |||
224 | |||
225 | poll_evdev(); |
||
226 | |||
117 | ligi | 227 | switch (input) |
43 | ligi | 228 | { |
127 | ligi | 229 | |
117 | ligi | 230 | |
231 | case INPUT_NONE: |
||
140 | ligi | 232 | printf("processing input none\n"); |
117 | ligi | 233 | break; |
43 | ligi | 234 | |
117 | ligi | 235 | case INPUT_EVDEV: |
140 | ligi | 236 | printf("processing input evdev\n"); |
483 | ligi | 237 | |
130 | ligi | 238 | |
239 | break; |
||
117 | ligi | 240 | |
241 | case INPUT_JOYDEV: |
||
140 | ligi | 242 | printf("processing input joydev\n"); |
117 | ligi | 243 | // poll values from input device |
244 | |||
245 | for (polls=0;polls<100;polls++) // FIXME - better Polling |
||
246 | { |
||
140 | ligi | 247 | read(joy_input_fd, &x52_event_struct, sizeof(struct js_event)); |
117 | ligi | 248 | |
249 | |||
250 | /* see what to do with the event */ |
||
251 | switch (x52_event_struct.type & ~JS_EVENT_INIT) |
||
252 | { |
||
253 | case JS_EVENT_AXIS: |
||
254 | axis [ x52_event_struct.number ] = x52_event_struct.value; |
||
255 | break; |
||
256 | case JS_EVENT_BUTTON: |
||
257 | button [ x52_event_struct.number ] = x52_event_struct.value; |
||
258 | break; |
||
259 | } |
||
260 | } |
||
130 | ligi | 261 | int x; |
117 | ligi | 262 | for( x=0 ; x<num_of_buttons ; ++x ) |
263 | if( button[x]==0) |
||
264 | button_trigger[x]=0; |
||
265 | else |
||
266 | { |
||
267 | if (button_trigger[x]<100)button_trigger[x]++; |
||
268 | } |
||
269 | break; |
||
140 | ligi | 270 | } // switch (input) |
43 | ligi | 271 | |
117 | ligi | 272 | printf("input done\n"); |
43 | ligi | 273 | |
47 | ligi | 274 | switch(state) |
275 | { |
||
276 | case STATEID_SCANNING: |
||
130 | ligi | 277 | |
50 | ligi | 278 | state=STATEID_CONNECTING; |
130 | ligi | 279 | /* |
48 | ligi | 280 | ExternControl.Digital[0]=0; |
281 | ExternControl.Digital[1]=0; |
||
282 | ExternControl.RemoteTasten=0; |
||
283 | ExternControl.Nick=(axis[1]>>8)*(-1)+127;; |
||
284 | |||
285 | printf("nick%d\n",ExternControl.Nick); |
||
286 | ExternControl.Roll=(axis[0]>>8)*(-1)+127;; |
||
287 | ExternControl.Gier=(axis[5]>>8)*(-1)+127;; |
||
288 | ExternControl.Gas=(axis[2]>>8)*(-1)+127; |
||
289 | ExternControl.Higt=0; |
||
290 | ExternControl.free=0; |
||
291 | ExternControl.Frame='t'; |
||
292 | ExternControl.Config=1; |
||
293 | |||
294 | printf("sending data\n"); |
||
295 | |||
50 | ligi | 296 | |
127 | ligi | 297 | if (connected)SendOutData('b', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
50 | ligi | 298 | gettimeofday(&time_struct1,NULL); |
48 | ligi | 299 | |
47 | ligi | 300 | if (button_trigger[BUTTON_SELECT]==1) |
301 | { |
||
302 | state=STATEID_CONNECTING; |
||
303 | clear_display(); |
||
304 | write_display(0,"connecting to"); |
||
305 | write_display(1,names[selected_bt_device]); |
||
127 | ligi | 306 | //connect_mk(addrs[selected_bt_device]); |
47 | ligi | 307 | write_display(0,"connected to"); |
308 | } |
||
43 | ligi | 309 | |
47 | ligi | 310 | if ((button_trigger[BUTTON_UP]+button_trigger[BUTTON_DOWN])==1) |
311 | { |
||
312 | printf("-> sel_dev %d - %d\n",selected_bt_device,button_trigger[19]); |
||
313 | if (button_trigger[BUTTON_DOWN]==1) |
||
314 | if (selected_bt_device>0) selected_bt_device--; |
||
315 | if (button_trigger[BUTTON_UP]==1) |
||
316 | if (selected_bt_device<bt_device_count-1) selected_bt_device++; |
||
317 | |||
127 | ligi | 318 | |
47 | ligi | 319 | } |
130 | ligi | 320 | */ |
47 | ligi | 321 | break; |
48 | ligi | 322 | |
47 | ligi | 323 | case STATEID_CONNECTING: |
127 | ligi | 324 | |
50 | ligi | 325 | |
127 | ligi | 326 | confirm_misses=0; |
140 | ligi | 327 | |
483 | ligi | 328 | RxBuffer[2]=0; |
130 | ligi | 329 | if (connected) |
483 | ligi | 330 | while (RxBuffer[2]!='B') |
127 | ligi | 331 | { |
50 | ligi | 332 | |
127 | ligi | 333 | RxBuffer[1]=0; |
130 | ligi | 334 | read_from_mk(); |
483 | ligi | 335 | bt_host_send(RxBuffer,rx_last_length); |
336 | printf("sending to host: %s",PrintableRxBuffer); |
||
50 | ligi | 337 | |
117 | ligi | 338 | |
127 | ligi | 339 | // ftime(&time_struct); |
130 | ligi | 340 | |
483 | ligi | 341 | printf("waiting for confirm frame ( confirmed:%d misses:%d %c)\n",complete_matches,complete_misses,RxBuffer[2]); |
342 | // RxBuffer[2]=0; |
||
43 | ligi | 343 | |
130 | ligi | 344 | // r=0; |
43 | ligi | 345 | |
117 | ligi | 346 | // new |
130 | ligi | 347 | /* |
117 | ligi | 348 | if (button_trigger[12]>1) |
349 | { |
||
350 | SendOutData('s', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
||
351 | button_trigger[12]=0; |
||
352 | } |
||
130 | ligi | 353 | */ |
354 | ExternControl.Frame='t'; |
||
117 | ligi | 355 | if (++confirm_misses>4) |
127 | ligi | 356 | { |
357 | complete_misses++; |
||
358 | printf("sending again\n"); |
||
359 | SendOutData('b', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
||
360 | } |
||
48 | ligi | 361 | } |
127 | ligi | 362 | else |
363 | printf("not connected to mk\n"); |
||
130 | ligi | 364 | |
50 | ligi | 365 | gettimeofday(&time_struct2,NULL); |
43 | ligi | 366 | |
140 | ligi | 367 | printf("last trip: %d\n",(int)(time_struct2.tv_usec-time_struct1.tv_usec)); |
130 | ligi | 368 | // act_mode=button[24] | (button[25]<<1); |
43 | ligi | 369 | |
127 | ligi | 370 | |
371 | |||
372 | // Step converting axis data to nick/roll/gier/gas/.. |
||
373 | |||
140 | ligi | 374 | // act_nick=(evdev_rel_axis[rel_axis_nick]-128)*nick_mul; |
127 | ligi | 375 | |
376 | |||
140 | ligi | 377 | |
378 | |||
483 | ligi | 379 | /* Mix input values */ |
380 | |||
381 | act_gas=0; |
||
382 | act_nick=0; |
||
383 | act_roll=0; |
||
384 | act_gier=0; |
||
385 | |||
386 | int act_input=0; |
||
387 | for (act_input=0;act_input<input_count;act_input++) |
||
388 | { |
||
389 | //process buttons |
||
390 | if (inputs[act_input].nick_up_btn!=-1) |
||
391 | { |
||
392 | if (inputs[act_input].evdev_button[inputs[act_input].nick_up_btn]!=0) |
||
393 | act_nick=100; |
||
394 | |||
395 | } |
||
396 | |||
397 | if (inputs[act_input].nick_down_btn!=-1) |
||
398 | { |
||
399 | if (inputs[act_input].evdev_button[inputs[act_input].nick_down_btn]!=0) |
||
400 | act_nick=-100; |
||
401 | |||
402 | } |
||
403 | |||
404 | if (inputs[act_input].roll_left_btn!=-1) |
||
405 | { |
||
406 | if (inputs[act_input].evdev_button[inputs[act_input].roll_left_btn]!=0) |
||
407 | act_roll=100; |
||
408 | |||
409 | } |
||
410 | |||
411 | if (inputs[act_input].roll_right_btn!=-1) |
||
412 | { |
||
413 | if (inputs[act_input].evdev_button[inputs[act_input].roll_right_btn]!=0) |
||
414 | act_roll=-100; |
||
415 | |||
416 | } |
||
417 | |||
418 | // process axis |
||
419 | |||
420 | if (inputs[act_input].rel_axis_nick!=-1) |
||
421 | act_nick=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_nick]*inputs[act_input].nick_mul; |
||
422 | |||
423 | if (inputs[act_input].rel_axis_roll!=-1) |
||
424 | act_roll=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_roll]*inputs[act_input].roll_mul; |
||
425 | |||
426 | |||
427 | if (inputs[act_input].rel_axis_gier!=-1) |
||
428 | act_gier=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_gier]*inputs[act_input].gier_mul; |
||
429 | |||
430 | |||
431 | if (inputs[act_input].rel_axis_gas!=-1) |
||
432 | act_gas=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_gas]*inputs[act_input].gas_mul; |
||
433 | |||
434 | |||
435 | |||
436 | } |
||
437 | |||
140 | ligi | 438 | switch(input) |
439 | { |
||
440 | case INPUT_EVDEV: |
||
483 | ligi | 441 | /* |
140 | ligi | 442 | act_nick=(evdev_rel_axis[rel_axis_nick]-nick_add)*nick_mul; |
443 | act_roll=(evdev_rel_axis[rel_axis_roll]-nick_add)*roll_mul; |
||
444 | act_gier=(evdev_rel_axis[rel_axis_gier]-nick_add)*gier_mul; |
||
445 | act_gas=(evdev_rel_axis[rel_axis_gas]-nick_add)*gas_mul; |
||
483 | ligi | 446 | */ |
140 | ligi | 447 | |
448 | break; |
||
449 | |||
450 | case INPUT_JOYDEV: |
||
451 | act_nick=(axis[rel_axis_nick])*nick_mul; |
||
452 | act_roll=(axis[rel_axis_roll])*roll_mul; |
||
453 | act_gier=(axis[rel_axis_gier])*gier_mul; |
||
454 | act_gas=(axis[rel_axis_gas]*-1+33000)*gas_mul; |
||
455 | |||
456 | break; |
||
457 | } |
||
458 | |||
459 | // act values clipping to usefull vals |
||
460 | // act_gas=0; |
||
461 | |||
462 | // act_gas=255; |
||
463 | |||
464 | |||
127 | ligi | 465 | /* |
130 | ligi | 466 | switch (act_mode) |
50 | ligi | 467 | { |
468 | case 0: |
||
117 | ligi | 469 | |
470 | |||
130 | ligi | 471 | act_nick=(axis[AXIS_NICK])*(INVERT_NICK); |
472 | act_roll=(axis[AXIS_ROLL])*(INVERT_ROLL); |
||
473 | act_gier=(axis[AXIS_GIER])*(INVERT_GIER); |
||
474 | act_gas=((axis[AXIS_GAS])-128)*(-1); |
||
117 | ligi | 475 | |
130 | ligi | 476 | // clip gas |
477 | if (act_gas<0) act_gas=0; |
||
50 | ligi | 478 | |
130 | ligi | 479 | if (act_gas>250) act_gas=250; |
117 | ligi | 480 | |
130 | ligi | 481 | //////// act_gas=0; |
482 | break; |
||
50 | ligi | 483 | |
484 | case 1: |
||
130 | ligi | 485 | act_nick=(axis[AXIS_NICK]>>8)*(INVERT_NICK)/2; |
486 | act_roll=(axis[AXIS_ROLL]>>8)*(INVERT_ROLL)/2; |
||
487 | act_gier=(axis[AXIS_GIER]>>8)*(INVERT_GIER)/2; |
||
488 | act_gas=(axis[AXIS_GAS]>>8)*(INVERT_GAS); |
||
50 | ligi | 489 | |
130 | ligi | 490 | break; |
50 | ligi | 491 | |
492 | case 2: |
||
130 | ligi | 493 | act_nick=(axis[AXIS_NICK]>>8)*(INVERT_NICK)/3; |
494 | act_roll=(axis[AXIS_ROLL]>>8)*(INVERT_ROLL)/3; |
||
495 | act_gier=(axis[AXIS_GIER]>>8)*(INVERT_GIER)/3; |
||
496 | act_gas=(axis[AXIS_GAS]>>8)*(INVERT_GAS); |
||
50 | ligi | 497 | |
498 | |||
130 | ligi | 499 | break; |
50 | ligi | 500 | |
501 | } |
||
127 | ligi | 502 | */ |
48 | ligi | 503 | ExternControl.Digital[0]=0; |
504 | ExternControl.Digital[1]=0; |
||
505 | ExternControl.RemoteTasten=0; |
||
130 | ligi | 506 | ExternControl.Higt=0; |
507 | ExternControl.free=0; |
||
508 | ExternControl.Frame='t'; |
||
509 | ExternControl.Config=1; |
||
510 | |||
511 | |||
50 | ligi | 512 | ExternControl.Nick=act_nick; //(axis[1]>>8)*(-1)/2; |
117 | ligi | 513 | ExternControl.Roll=act_roll*(-1); //(axis[0]>>8)*(-1)/2; |
514 | ExternControl.Gier=act_gier; // ************ |
||
515 | ExternControl.Gas=act_gas; // ************ |
||
483 | ligi | 516 | ExternControl.Gas=255; // ************ |
50 | ligi | 517 | |
130 | ligi | 518 | |
48 | ligi | 519 | |
140 | ligi | 520 | printf("act_mode %d , act_nick %d , act_roll %d , act_gier %d , act_gas %d",act_mode , act_nick , act_roll , act_gier , act_gas); |
521 | |||
127 | ligi | 522 | if (connected) |
523 | { |
||
140 | ligi | 524 | complete_matches++; |
127 | ligi | 525 | printf("sending data\n"); |
526 | |||
527 | SendOutData('b', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
||
528 | gettimeofday(&time_struct1,NULL); |
||
529 | printf("sent data\n"); |
||
530 | } |
||
48 | ligi | 531 | |
130 | ligi | 532 | // printf("sleeping\n"); |
533 | // for (polls=0;polls<100;polls++) // FIXME - better Polling |
||
534 | // printf("end_sleep\n"); |
||
127 | ligi | 535 | |
130 | ligi | 536 | // int v=axis[6]/655+50; |
537 | // if (v!=v_old)if (x52_output) x52_setbri(x52_output, 0,v ); |
||
538 | // v_old=v; |
||
47 | ligi | 539 | |
130 | ligi | 540 | // printf("v: %d \n",v); |
127 | ligi | 541 | |
542 | |||
130 | ligi | 543 | /* |
544 | for (i=0;i<num_of_axis;i++) |
||
47 | ligi | 545 | printf("A%d: %d ", i,axis[i]>>8 ); |
546 | |||
130 | ligi | 547 | for( x=0 ; x<num_of_buttons ; ++x ) |
47 | ligi | 548 | |
549 | printf("B%d: %d ", x, button[x] ); |
||
130 | ligi | 550 | */ |
551 | |||
47 | ligi | 552 | break; |
553 | } |
||
127 | ligi | 554 | |
48 | ligi | 555 | printf("\n"); |
47 | ligi | 556 | fflush(stdout); |
130 | ligi | 557 | printf("loop fin ( confirmed:%d misses:%d | debug_sets:%d )\n",complete_matches,complete_misses,debug_sets); |
140 | ligi | 558 | printf("------------------------------------------------------------------------\n"); |
43 | ligi | 559 | |
50 | ligi | 560 | } |
41 | ligi | 561 | |
43 | ligi | 562 | |
47 | ligi | 563 | /******************** Cleanup **********************/ |
140 | ligi | 564 | close(joy_input_fd); |
127 | ligi | 565 | close(mk_socket); |
41 | ligi | 566 | |
567 | if (x52_output) x52_close(x52_output); |
||
568 | return 0; |
||
569 | } |