linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Anssi Hannula <anssi.hannula@iki.fi>
Cc: Elias Vanderstuyft <elias.vds@gmail.com>,
	linux-input@vger.kernel.org, wine-devel@winehq.org
Subject: Re: ff-core effect id handling in case of a failed effect upload
Date: Wed, 19 Feb 2014 13:05:23 -0800	[thread overview]
Message-ID: <20140219210523.GA13951@core.coreip.homeip.net> (raw)
In-Reply-To: <5304E0A0.5070007@iki.fi>

On Wed, Feb 19, 2014 at 06:49:36PM +0200, Anssi Hannula wrote:
> (added Dmitry to CC)
> 
> 19.02.2014 13:42, Elias Vanderstuyft kirjoitti:
> > Hi,
> > 
> 
> Hi,
> 
> > In the process of reviewing the Wine DInput translation layer, I
> > noticed an inconvenience (in the ff-core implementation?) that can
> > possibly lead to confusing problems to application developers (not
> > only for Wine), in short:
> > If a new (id==-1) effect was uploaded (look at
> > ff-core.c::input_ff_upload(...)) that failed (e.g. returning EINVAL),
> > ff-core will have assigned a positive number to the effect id. This
> > can be confusing because the dev->ff->effects[] array will not contain
> > an element at the index of that new effect id.
> 
> I agree that this is a bit confusing, and the kernel code should
> probably be modified to not clobber the ioctl-provided effect on failure
> (effect->id is set to an "undefined" value, i.e. next free effect slot).
> 
> Dmitry, WDYT?

Yeah, it looks like we need to change evdev.c to read:

		error = input_ff_upload(dev, &effect, file);
		if (error)
			return error;

		if (put_user(effect.id, &(((struct ff_effect __user *)p)->id)))
			return -EFAULT;

		return 0;

Unfortunately applications should still expect changed effect ID for
quite some time.

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2014-02-19 21:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 11:42 ff-core effect id handling in case of a failed effect upload Elias Vanderstuyft
2014-02-19 16:49 ` Anssi Hannula
2014-02-19 17:32   ` Elias Vanderstuyft
2014-02-19 19:32     ` Andrew Eikum
2014-02-19 19:49       ` Elias Vanderstuyft
2014-02-19 21:05   ` Dmitry Torokhov [this message]
2014-02-19 22:14     ` Elias Vanderstuyft
2014-02-23  6:30       ` Dmitry Torokhov
2014-02-23 14:27         ` Elias Vanderstuyft

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=20140219210523.GA13951@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=anssi.hannula@iki.fi \
    --cc=elias.vds@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=wine-devel@winehq.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 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).