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) |
||
486 | ligi | 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 | } |
||
43 | ligi | 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 | |
486 | ligi | 91 | // bt_host_init(); |
483 | ligi | 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(); |
486 | ligi | 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 | |
488 | ligi | 326 | |
327 | |||
328 | |||
127 | ligi | 329 | confirm_misses=0; |
140 | ligi | 330 | |
483 | ligi | 331 | RxBuffer[2]=0; |
130 | ligi | 332 | if (connected) |
127 | ligi | 333 | { |
488 | ligi | 334 | read_from_mk(); |
335 | if (RxBuffer[2]=='B') |
||
336 | complete_misses++; |
||
337 | /*while (RxBuffer[2]!='B') |
||
338 | { |
||
50 | ligi | 339 | |
127 | ligi | 340 | RxBuffer[1]=0; |
130 | ligi | 341 | read_from_mk(); |
486 | ligi | 342 | // bt_host_send(RxBuffer,rx_last_length); |
483 | ligi | 343 | printf("sending to host: %s",PrintableRxBuffer); |
50 | ligi | 344 | |
117 | ligi | 345 | |
127 | ligi | 346 | // ftime(&time_struct); |
130 | ligi | 347 | |
483 | ligi | 348 | printf("waiting for confirm frame ( confirmed:%d misses:%d %c)\n",complete_matches,complete_misses,RxBuffer[2]); |
349 | // RxBuffer[2]=0; |
||
43 | ligi | 350 | |
130 | ligi | 351 | // r=0; |
43 | ligi | 352 | |
117 | ligi | 353 | // new |
488 | ligi | 354 | |
355 | //if (button_trigger[12]>1) |
||
356 | // { |
||
357 | // SendOutData('s', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
||
358 | // button_trigger[12]=0; |
||
359 | // } |
||
360 | |||
130 | ligi | 361 | ExternControl.Frame='t'; |
117 | ligi | 362 | if (++confirm_misses>4) |
127 | ligi | 363 | { |
364 | complete_misses++; |
||
365 | printf("sending again\n"); |
||
366 | SendOutData('b', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
||
367 | } |
||
488 | ligi | 368 | */ |
48 | ligi | 369 | } |
127 | ligi | 370 | else |
371 | printf("not connected to mk\n"); |
||
488 | ligi | 372 | |
50 | ligi | 373 | gettimeofday(&time_struct2,NULL); |
43 | ligi | 374 | |
140 | ligi | 375 | printf("last trip: %d\n",(int)(time_struct2.tv_usec-time_struct1.tv_usec)); |
130 | ligi | 376 | // act_mode=button[24] | (button[25]<<1); |
43 | ligi | 377 | |
127 | ligi | 378 | |
379 | |||
380 | // Step converting axis data to nick/roll/gier/gas/.. |
||
381 | |||
140 | ligi | 382 | // act_nick=(evdev_rel_axis[rel_axis_nick]-128)*nick_mul; |
127 | ligi | 383 | |
384 | |||
140 | ligi | 385 | |
386 | |||
483 | ligi | 387 | /* Mix input values */ |
388 | |||
389 | act_gas=0; |
||
390 | act_nick=0; |
||
391 | act_roll=0; |
||
392 | act_gier=0; |
||
393 | |||
394 | int act_input=0; |
||
395 | for (act_input=0;act_input<input_count;act_input++) |
||
396 | { |
||
397 | //process buttons |
||
398 | if (inputs[act_input].nick_up_btn!=-1) |
||
399 | { |
||
400 | if (inputs[act_input].evdev_button[inputs[act_input].nick_up_btn]!=0) |
||
401 | act_nick=100; |
||
402 | |||
403 | } |
||
404 | |||
405 | if (inputs[act_input].nick_down_btn!=-1) |
||
406 | { |
||
407 | if (inputs[act_input].evdev_button[inputs[act_input].nick_down_btn]!=0) |
||
408 | act_nick=-100; |
||
409 | |||
410 | } |
||
411 | |||
412 | if (inputs[act_input].roll_left_btn!=-1) |
||
413 | { |
||
414 | if (inputs[act_input].evdev_button[inputs[act_input].roll_left_btn]!=0) |
||
415 | act_roll=100; |
||
416 | |||
417 | } |
||
418 | |||
419 | if (inputs[act_input].roll_right_btn!=-1) |
||
420 | { |
||
421 | if (inputs[act_input].evdev_button[inputs[act_input].roll_right_btn]!=0) |
||
422 | act_roll=-100; |
||
423 | |||
424 | } |
||
425 | |||
426 | // process axis |
||
427 | |||
428 | if (inputs[act_input].rel_axis_nick!=-1) |
||
429 | act_nick=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_nick]*inputs[act_input].nick_mul; |
||
430 | |||
431 | if (inputs[act_input].rel_axis_roll!=-1) |
||
432 | act_roll=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_roll]*inputs[act_input].roll_mul; |
||
433 | |||
434 | |||
435 | if (inputs[act_input].rel_axis_gier!=-1) |
||
436 | act_gier=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_gier]*inputs[act_input].gier_mul; |
||
437 | |||
438 | |||
439 | if (inputs[act_input].rel_axis_gas!=-1) |
||
440 | act_gas=inputs[act_input].evdev_rel_axis[inputs[act_input].rel_axis_gas]*inputs[act_input].gas_mul; |
||
441 | |||
442 | |||
443 | |||
444 | } |
||
445 | |||
140 | ligi | 446 | switch(input) |
447 | { |
||
448 | case INPUT_EVDEV: |
||
483 | ligi | 449 | /* |
140 | ligi | 450 | act_nick=(evdev_rel_axis[rel_axis_nick]-nick_add)*nick_mul; |
451 | act_roll=(evdev_rel_axis[rel_axis_roll]-nick_add)*roll_mul; |
||
452 | act_gier=(evdev_rel_axis[rel_axis_gier]-nick_add)*gier_mul; |
||
453 | act_gas=(evdev_rel_axis[rel_axis_gas]-nick_add)*gas_mul; |
||
483 | ligi | 454 | */ |
140 | ligi | 455 | |
456 | break; |
||
457 | |||
458 | case INPUT_JOYDEV: |
||
459 | act_nick=(axis[rel_axis_nick])*nick_mul; |
||
460 | act_roll=(axis[rel_axis_roll])*roll_mul; |
||
461 | act_gier=(axis[rel_axis_gier])*gier_mul; |
||
462 | act_gas=(axis[rel_axis_gas]*-1+33000)*gas_mul; |
||
463 | |||
464 | break; |
||
465 | } |
||
466 | |||
467 | // act values clipping to usefull vals |
||
468 | // act_gas=0; |
||
469 | |||
470 | // act_gas=255; |
||
471 | |||
472 | |||
127 | ligi | 473 | /* |
130 | ligi | 474 | switch (act_mode) |
50 | ligi | 475 | { |
476 | case 0: |
||
117 | ligi | 477 | |
478 | |||
130 | ligi | 479 | act_nick=(axis[AXIS_NICK])*(INVERT_NICK); |
480 | act_roll=(axis[AXIS_ROLL])*(INVERT_ROLL); |
||
481 | act_gier=(axis[AXIS_GIER])*(INVERT_GIER); |
||
482 | act_gas=((axis[AXIS_GAS])-128)*(-1); |
||
117 | ligi | 483 | |
130 | ligi | 484 | // clip gas |
485 | if (act_gas<0) act_gas=0; |
||
50 | ligi | 486 | |
130 | ligi | 487 | if (act_gas>250) act_gas=250; |
117 | ligi | 488 | |
130 | ligi | 489 | //////// act_gas=0; |
490 | break; |
||
50 | ligi | 491 | |
492 | case 1: |
||
130 | ligi | 493 | act_nick=(axis[AXIS_NICK]>>8)*(INVERT_NICK)/2; |
494 | act_roll=(axis[AXIS_ROLL]>>8)*(INVERT_ROLL)/2; |
||
495 | act_gier=(axis[AXIS_GIER]>>8)*(INVERT_GIER)/2; |
||
496 | act_gas=(axis[AXIS_GAS]>>8)*(INVERT_GAS); |
||
50 | ligi | 497 | |
130 | ligi | 498 | break; |
50 | ligi | 499 | |
500 | case 2: |
||
130 | ligi | 501 | act_nick=(axis[AXIS_NICK]>>8)*(INVERT_NICK)/3; |
502 | act_roll=(axis[AXIS_ROLL]>>8)*(INVERT_ROLL)/3; |
||
503 | act_gier=(axis[AXIS_GIER]>>8)*(INVERT_GIER)/3; |
||
504 | act_gas=(axis[AXIS_GAS]>>8)*(INVERT_GAS); |
||
50 | ligi | 505 | |
506 | |||
130 | ligi | 507 | break; |
50 | ligi | 508 | |
509 | } |
||
127 | ligi | 510 | */ |
48 | ligi | 511 | ExternControl.Digital[0]=0; |
512 | ExternControl.Digital[1]=0; |
||
513 | ExternControl.RemoteTasten=0; |
||
130 | ligi | 514 | ExternControl.Higt=0; |
515 | ExternControl.free=0; |
||
516 | ExternControl.Frame='t'; |
||
517 | ExternControl.Config=1; |
||
518 | |||
519 | |||
50 | ligi | 520 | ExternControl.Nick=act_nick; //(axis[1]>>8)*(-1)/2; |
117 | ligi | 521 | ExternControl.Roll=act_roll*(-1); //(axis[0]>>8)*(-1)/2; |
522 | ExternControl.Gier=act_gier; // ************ |
||
523 | ExternControl.Gas=act_gas; // ************ |
||
483 | ligi | 524 | ExternControl.Gas=255; // ************ |
50 | ligi | 525 | |
130 | ligi | 526 | |
48 | ligi | 527 | |
140 | ligi | 528 | 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); |
529 | |||
127 | ligi | 530 | if (connected) |
531 | { |
||
140 | ligi | 532 | complete_matches++; |
127 | ligi | 533 | printf("sending data\n"); |
534 | |||
535 | SendOutData('b', 0, (unsigned char *)&ExternControl, sizeof(ExternControl)); |
||
536 | gettimeofday(&time_struct1,NULL); |
||
537 | printf("sent data\n"); |
||
538 | } |
||
48 | ligi | 539 | |
130 | ligi | 540 | // printf("sleeping\n"); |
541 | // for (polls=0;polls<100;polls++) // FIXME - better Polling |
||
542 | // printf("end_sleep\n"); |
||
127 | ligi | 543 | |
130 | ligi | 544 | // int v=axis[6]/655+50; |
545 | // if (v!=v_old)if (x52_output) x52_setbri(x52_output, 0,v ); |
||
546 | // v_old=v; |
||
47 | ligi | 547 | |
130 | ligi | 548 | // printf("v: %d \n",v); |
127 | ligi | 549 | |
550 | |||
130 | ligi | 551 | /* |
552 | for (i=0;i<num_of_axis;i++) |
||
47 | ligi | 553 | printf("A%d: %d ", i,axis[i]>>8 ); |
554 | |||
130 | ligi | 555 | for( x=0 ; x<num_of_buttons ; ++x ) |
47 | ligi | 556 | |
557 | printf("B%d: %d ", x, button[x] ); |
||
130 | ligi | 558 | */ |
559 | |||
47 | ligi | 560 | break; |
561 | } |
||
127 | ligi | 562 | |
48 | ligi | 563 | printf("\n"); |
47 | ligi | 564 | fflush(stdout); |
130 | ligi | 565 | printf("loop fin ( confirmed:%d misses:%d | debug_sets:%d )\n",complete_matches,complete_misses,debug_sets); |
140 | ligi | 566 | printf("------------------------------------------------------------------------\n"); |
43 | ligi | 567 | |
50 | ligi | 568 | } |
41 | ligi | 569 | |
43 | ligi | 570 | |
47 | ligi | 571 | /******************** Cleanup **********************/ |
140 | ligi | 572 | close(joy_input_fd); |
127 | ligi | 573 | close(mk_socket); |
41 | ligi | 574 | |
575 | if (x52_output) x52_close(x52_output); |
||
576 | return 0; |
||
577 | } |