Estoy creando una aplicación y para que interactue con Ubuntu estoy haciendo uso de "linux/input.h" y "linux/uinput.h", el problema está en que me compila sin ningún tipo de error pero no hace nada, el fallo está hay casi seguro porque los he hecho un seguimiento a la aplicacion y registra los botones que pulso y todo, pero no ocurre nada.
Os dejo mi codigo para inicializar el driver.
Código
Ojala podais ayudarme!
int wmDevice::init_device(){ //open uinput and creating descriptor if ((fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK | O_NDELAY)) == 0){ std::cout << "Unable to open /dev/uinput" << std::endl; return 1; } //configure uinput device parameters ret = ioctl(fd, UI_SET_EVBIT, EV_KEY); ret = ioctl(fd, UI_SET_EVBIT, EV_ABS); // ret = ioctl(fd, UI_SET_EVBIT, EV_SYN); ret = ioctl(fd, UI_SET_KEYBIT, KEY_SELECT); //left button mouse = A wiimote button wiimote ret = ioctl(fd, UI_SET_KEYBIT, KEY_CONTEXT_MENU); // right button mouse = B button wiimote ret = ioctl(fd, UI_SET_KEYBIT, KEY_SCROLLDOWN); // wiimote = 2 ret = ioctl(fd, UI_SET_KEYBIT, KEY_SCROLLUP); //wiimote = 1 ret = ioctl(fd, UI_SET_KEYBIT, KEY_POWER); //power (hold) ret = ioctl(fd, UI_SET_KEYBIT, KEY_ZOOM); //Zoom = + ret = ioctl(fd, UI_SET_KEYBIT, KEY_DELETEFILE); // (hold) - ret = ioctl(fd, UI_SET_KEYBIT, KEY_CLOSE); // - ret = ioctl(fd, UI_SET_ABSBIT, ABS_X); ret = ioctl(fd, UI_SET_ABSBIT, ABS_Y); //****************************************// memset(&userDev, 0, sizeof(userDev)); strcpy(userDev.name, "wiimote"); userDev.id.bustype = BUS_BLUETOOTH; userDev.id.vendor = 0x1234; userDev.id.product = 0x01; userDev.id.version = 1; userDev.absmax[ABS_X] = 1920; userDev.absmin[ABS_X] = 0; userDev.absmax[ABS_Y] = 1080; userDev.absmin[ABS_Y] = 0; //*****************************************// ret = write(fd, &userDev, sizeof(userDev)); ret = ioctl(fd, UI_DEV_CREATE); return 0; }