static usb_dev_handle *get_ir(void) { static usb_dev_handle *ir = NULL; if (!ir) { usb_init(); usb_find_busses(); usb_find_devices(); ir = find_ir(); if (!ir) { fprintf(stderr, "IR receiver not found, quitting\n"); exit(1); } /* interface is normally handled by hiddev */ usb_detach_kernel_driver_np(ir, 0); if (usb_claim_interface(ir, 0)) { fprintf(stderr, "error claiming interface, are you root?\n"); exit(2); } //usb_reset(ir); //usb_set_configuration(ir, 0); } return ir; }
task main() { int i=0; int wait_time; disableDiagnosticsDisplay(); wait_time = time(); position(); waitForStart(); z = r * -1; wait10Msec(wait_time); i = find_ir(i); move_past_buckets(i); }