6 int main(int argc, char *argv[])
8 cwiid_wiimote_t *wiimote;
9 struct cwiid_state state;
10 bdaddr_t addr = *BDADDR_ANY;
13 printf("Put Wiimote in discoverable mode (press 1+2) and hit enter\n");
16 wiimote = cwiid_open(&addr, 0);
18 errx(1, "Can't find the Wiimote");
20 printf("Setting the IR repeat mode.\n");
21 if (cwiid_set_rpt_mode(wiimote, CWIID_RPT_IR))
22 errx(1, "Can't set IR repeat mode");
25 if (cwiid_get_state(wiimote, &state))
29 for (i = 0; i < CWIID_IR_SRC_COUNT; i++) {
30 if (!state.ir_src[i].valid)
34 state.ir_src[i].pos[CWIID_X],
35 state.ir_src[i].pos[CWIID_Y]);