Re: uinput: How to use force feedback?
From: Manuel Reimer <hidden>
Date: 2016-02-05 20:58:45
Hello, I just want to add here, that I found the reason for this problem. It is required that the ff_effects_max field of the uinput_user_dev struct is set. Without doing this everything just hangs... Best regards, Manuel On 02/05/2016 04:54 PM, Manuel Reimer wrote:
On 01/17/2016 04:46 PM, Elias Vanderstuyft wrote:quoted
Concerning this, the following may give you an example how to read incoming FF events on uinput: https://github.com/xboxdrv/xboxdrv/blob/8e9fb6b40df568d4e4af63e80518366ee4aa5fd3/src/linux_uinput.cpp#L341Tried that and I'm pretty close to giving up... I've added the following to my uinput init function: // Set up force feedback parameters ret = ioctl(fd, UI_SET_EVBIT, EV_FF); ret = ioctl(fd, UI_SET_FFBIT, FF_PERIODIC); ret = ioctl(fd, UI_SET_FFBIT, FF_RUMBLE); ret = ioctl(fd, UI_SET_FFBIT, FF_GAIN); ret = ioctl(fd, UI_SET_FFBIT, FF_SQUARE); ret = ioctl(fd, UI_SET_FFBIT, FF_TRIANGLE); ret = ioctl(fd, UI_SET_FFBIT, FF_SINE); From my device handling thread, I'm starting a separate thread to handle the opposite direction of communication. Plan is to do blocking read from the open uinput device. I open the device with O_RDWR to be able to read and write. The "rumble thread" starts with: pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); struct input_event event; while (1) { ssize_t n = read(args->fduinput, &event, sizeof(event)); printf("n: %d\n", n); Everything beyond this never executes. The read blocks forever. And even worse: If the read blocks, my "driver", and all programs connected to my input device, are deadlocked. No chance to kill them. And to be honest: After three hours of debugging I'm kind of sick of rebooting my machine over and over again. Any chance to get some hint? Thanks in advance Manuel -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html