All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manuel Reimer <Manuel.Spam@nurfuerspam.de>
To: linux-input@vger.kernel.org
Subject: Re: uinput: How to use force feedback?
Date: Fri, 5 Feb 2016 21:58:37 +0100	[thread overview]
Message-ID: <n932dt$g8i$1@ger.gmane.org> (raw)
In-Reply-To: <n92gka$1fj$1@ger.gmane.org>

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:
>> 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



  reply	other threads:[~2016-02-05 20:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-17 13:27 uinput: How to use force feedback? Manuel Reimer
2016-01-17 15:46 ` Elias Vanderstuyft
2016-01-17 15:47   ` Elias Vanderstuyft
2016-01-18 17:39   ` Tuomas Räsänen
2016-02-05 15:54   ` Manuel Reimer
2016-02-05 20:58     ` Manuel Reimer [this message]
2016-02-10 21:41       ` Elias Vanderstuyft
2016-02-15 20:05         ` Manuel Reimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='n932dt$g8i$1@ger.gmane.org' \
    --to=manuel.spam@nurfuerspam.de \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.