linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to get the kernel to emulate force feedback events?
@ 2016-02-20 19:28 Manuel Reimer
  2016-02-21 10:20 ` Manuel Reimer
  2016-02-21 14:07 ` Manuel Reimer
  0 siblings, 2 replies; 3+ messages in thread
From: Manuel Reimer @ 2016-02-20 19:28 UTC (permalink / raw)
  To: linux-input

Hello,

if I plug my Xbox 360 controller and run fftest on it, then the 
following force feedback modes are listed as supported:

| Force feedback effects types: Periodic, Rumble, Gain,
| Force feedback periodic effects: Square, Triangle, Sine,

If I have a look at the driver itself, then it actually only supports 
FF_RUMBLE:

https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c#L1054
https://github.com/torvalds/linux/blob/master/drivers/input/joystick/xpad.c#L966

So somewhere in the kernel source there has to be some kind of built-in 
force feedback effect emulation...

If I do the same in an uinput driver (only report "FF_RUMBLE" as being 
supported), then fftest only shows this one effect to be supported by 
the device. The "kernel side emulation" does not kick in...

The kernel documentation 
(https://www.kernel.org/doc/Documentation/input/ff.txt) says:

| Note: In most cases you should use FF_PERIODIC instead of FF_RUMBLE.
|       All devices that support FF_RUMBLE support FF_PERIODIC (square,
|       triangle, sine) and the other way around.

But what could be the mistake, which allowed me to create a device 
driver which actually only supports FF_RUMBLE? Are there any special 
driver parameters that have to be present, so the kernel side emulation 
gets active?

Thanks in advance.

Best regards,

Manuel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to get the kernel to emulate force feedback events?
  2016-02-20 19:28 How to get the kernel to emulate force feedback events? Manuel Reimer
@ 2016-02-21 10:20 ` Manuel Reimer
  2016-02-21 14:07 ` Manuel Reimer
  1 sibling, 0 replies; 3+ messages in thread
From: Manuel Reimer @ 2016-02-21 10:20 UTC (permalink / raw)
  To: linux-input

On 02/20/2016 08:28 PM, Manuel Reimer wrote:
> But what could be the mistake, which allowed me to create a device
> driver which actually only supports FF_RUMBLE? Are there any special
> driver parameters that have to be present, so the kernel side emulation
> gets active?

After searching through the kernel source, I've found some more 
information. Event emulation is done here:

https://github.com/torvalds/linux/blob/master/drivers/input/ff-memless.c

And this is not triggered by the uinput kernel driver at all.

Would it be possible to add this feature to uinput?

Let's say: If only "FF_RUMBLE" is set and the device reports to be only 
able to handle one ff event, then initialize ff-memless.

I could try to create a patch for that, but it would be nice if someone 
of the "linux input pros" could at least tell what they think about 
this? Is this possible at all or is there anything which would make this 
fail?

Thanks in advance.

Best regards

Manuel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to get the kernel to emulate force feedback events?
  2016-02-20 19:28 How to get the kernel to emulate force feedback events? Manuel Reimer
  2016-02-21 10:20 ` Manuel Reimer
@ 2016-02-21 14:07 ` Manuel Reimer
  1 sibling, 0 replies; 3+ messages in thread
From: Manuel Reimer @ 2016-02-21 14:07 UTC (permalink / raw)
  To: linux-input

Resending message. Is the list broken?

On 02/20/2016 08:28 PM, Manuel Reimer wrote:
> But what could be the mistake, which allowed me to create a device
> driver which actually only supports FF_RUMBLE? Are there any special
> driver parameters that have to be present, so the kernel side emulation
> gets active?

After searching through the kernel source, I've found some more 
information. Event emulation is done here:

https://github.com/torvalds/linux/blob/master/drivers/input/ff-memless.c

And this is not triggered by the uinput kernel driver at all.

Would it be possible to add this feature to uinput?

Let's say: If only "FF_RUMBLE" is set and the device reports to be only 
able to handle one ff event, then initialize ff-memless.

I could try to create a patch for that, but it would be nice if someone 
of the "linux input pros" could at least tell what they think about 
this? Is this possible at all or is there anything which would make this 
fail?

Thanks in advance.

Best regards

Manuel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-21 17:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-20 19:28 How to get the kernel to emulate force feedback events? Manuel Reimer
2016-02-21 10:20 ` Manuel Reimer
2016-02-21 14:07 ` Manuel Reimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).