c linux events wiimote wiiuse

Problemas al usar la biblioteca wiiuse y sus eventos



linux events (1)

Cambiar a CWild

(Nota: esta respuesta se basa en el informe del póster de lo que ya ha hecho para que se pueda eliminar de la lista principal)

Recientemente descargué la biblioteca de wiiuse y tengo problemas para usarla. Escribí un pequeño código pero el control remoto se desconecta justo después de la conexión. Incluso el código presente en el sitio web del autor no funciona; Lo mismo sucede cuando intento ese código. Probé la aplicación de demostración que obtuve con la biblioteca, pero funciona bien.

Estoy usando Windows XP SP3 y MinGW (gcc 4.5.0) para compilar los códigos.

EDITAR 1

He intentado lo mismo con Linux. Allí, no sufre con el problema de desconexión, pero tiene problemas para seleccionar los EVENTOS correctos. Lo que sea que haga, solo emite / atrapa a WIIUSE_NONE . El WIIUSE_EVENT nunca se emite / captura.

Aquí está mi código:

#include <stdio.h> #include <stdlib.h> #include "wiiuse.h" #define NUMBER_OF_REMOTES 1 void handle_event(struct wiimote_t* rm){ if(IS_PRESSED(rm, WIIMOTE_BUTTON_UP)){ printf("/n - IR Activated - /n"); wiiuse_set_ir(rm,1); } else if(IS_PRESSED(rm, WIIMOTE_BUTTON_DOWN)){ printf("/n - IR Dectivated - /n"); wiiuse_set_ir(rm,0); } if(WIIUSE_USING_IR(rm)){ for(int i=0; i<4; i++){ if(rm->ir.dot[i].visible){ printf("IR source %i: (%u, %u)/n", i, rm->ir.dot[i].x, rm->ir.dot[i].y); } printf("IR cursor: (%u, %u)/n", rm->ir.x, rm->ir.y); printf("IR z distance: %f/n", rm->ir.z); } } } void handle_disconnect(struct wiimote_t* rm){ printf("/n - DISCONNECTED - ID: %i/n/n", rm->unid); } int main() { wiimote** remote = wiiuse_init(NUMBER_OF_REMOTES); printf("Searching..."); int found = wiiuse_find(remote, NUMBER_OF_REMOTES, 5000); printf("Found %d devices/n", found); int connected = wiiuse_connect(remote, found); if(!connected){ printf("Failed to connect/n"); return 0; } else{ printf("Connected/n"); wiiuse_rumble(remote[0],1); Sleep(250); wiiuse_rumble(remote[0],0); while(1){ if (wiiuse_poll(remote, NUMBER_OF_REMOTES)) { for(int i=0;i<NUMBER_OF_REMOTES; i++){ switch(remote[i]->event){ case WIIUSE_EVENT: handle_event(remote[i]); break; case WIIUSE_DISCONNECT: case WIIUSE_UNEXPECTED_DISCONNECT: handle_disconnect(remote[i]); break; default: break; } } } } wiiuse_cleanup(remote,NUMBER_OF_REMOTES); } }

¿Nadie puede hacer algo? Realmente necesito solucionar el problema lo antes posible.