Thread (8 messages) 8 messages, 4 authors, 2016-02-15

Re: uinput: How to use force feedback?

flat view

From: Manuel Reimer <hidden>
Date: 2016-02-05 15:54:59

On 01/17/2016 04:46 PM, Elias Vanderstuyft wrote:
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#L341
Tried 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help