Re: uinput: How to use force feedback?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux