linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@gmail.com>
To: "Bruno Prémont" <bonbons@linux-vserver.org>
Cc: Andrew de los Reyes <andrew-vger@gizmolabs.org>,
	Linux Input <linux-input@vger.kernel.org>,
	Jiri Kosina <jkosina@suse.cz>,
	David Herrmann <dh.herrmann@googlemail.com>
Subject: Re: [PATCH] HID: Separate struct hid_device's driver_lock into two locks.
Date: Mon, 26 Nov 2012 19:34:18 +0100	[thread overview]
Message-ID: <CAN+gG=ENOU1oYRLd2ZMhPeCFPmTtiYRDZuuW3idvULShrnkPUg@mail.gmail.com> (raw)
In-Reply-To: <20121126185627.7bff1f84@neptune.home>

Hi Bruno,

On Mon, Nov 26, 2012 at 6:56 PM, Bruno Prémont
<bonbons@linux-vserver.org> wrote:
> Hi Andrew,
>
> [CCing David Herrmann]
>
>
> On Sun, 25 November 2012 Andrew de los Reyes wrote:
>> Benjamin Tissoires and Nestor Lopez Casado have been helping me to add
>> Linux support for new Logitech Touch Mice (T620, T400). After running
>> into a road-block in hid-core, and solving it with this patch, we
>> thought it was good to show the community and see if this is okay, or
>> if there's a better solution that we've missed.
>>
>> Thanks for your comments,
>> -andrew
>>
>> This patch separates struct hid_device's driver_lock into two. The
>> goal is to allow hid device drivers to receive input during their
>> probe() function call. This is necessary because some drivers need to
>> communicate with the device to determine parameters needed during
>> probe (e.g., size of a multi-touch surface).
>>
>> Historically, three functions used driver_lock:
>>
>> - hid_device_probe: blocks to acquire lock
>> - hid_device_remove: blocks to acquire lock
>> - hid_input_report: if locked returns -EBUSY, else acquires lock
>>
>> This patch adds another lock (driver_input_lock) which is used to
>> block input from occurring. The lock behavior is now:
>>
>> - hid_device_probe: blocks to acq. driver_lock, then driver_input_lock
>> - hid_device_remove: blocks to acq. driver_lock, then driver_input_lock
>> - hid_input_report: if driver_input_lock locked returns -EBUSY, else
>>   acquires driver_input_lock
>>
>> This results in no behavior change for existing devices and
>> drivers. However, during a probe() function call in a driver, that
>> driver may now selectively unlock driver_input_lock to let input
>> events come through, then re-lock.
>
> That is more or less a new approach to release the restriction added in
> commit 4ea5454203d991ec85264f64f89ca8855fce69b0
> (HID: Fix race condition between driver core and ll-driver).
>
> From your suggested change the question could be if releasing the input
> lock should be connected to hw_start() / hw_stop() calls...
>
> Though connecting those together would certainly require some review of
> existing drivers in order not to reopen the can of worms closed by above
> mentioned commit.
>

It is clear that the goal is to make commit
4ea5454203d991ec85264f64f89ca8855fce69b0 less restrictive.
The problem is that this commit stops any communication with the
device, even configuration communication.

Logitech devices use their own protocol on top of the HID standard
protocol. For touch devices, this proprietary protocol requires to ask
the device for axis ranges, etc...

So here, the idea is not to open the can of worm for every hid devices
through hw_start() / hw_stop() calls, I think the idea of Andrew is
just to allow hid-logitech-dj to get rid of this restriction in some
particular circumstances.
Consider this as a controlled backdoor of the can of worms :)

Cheers,
Benjamin
--
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:[~2012-11-26 18:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-25 18:48 [PATCH] HID: Separate struct hid_device's driver_lock into two locks Andrew de los Reyes
2012-11-26 17:56 ` Bruno Prémont
2012-11-26 18:34   ` Benjamin Tissoires [this message]
2012-11-26 18:54     ` David Herrmann
2012-11-26 20:50       ` Andrew de los Reyes
2012-12-04  8:04       ` Jiri Kosina
2012-12-03 13:17     ` Jiri Kosina
2012-12-03 17:53       ` Nestor Lopez Casado
2013-02-05 15:07         ` Jiri Kosina
2013-02-05 16:19           ` Nestor Lopez Casado
     [not found]             ` <CAG_cf+ev2y1MHNJFYZycbjQfNgk4hYYRaEoFsKkZyhzAzMgc1A@mail.gmail.com>
2013-02-05 17:22               ` David Herrmann
2013-02-05 17:50                 ` Nestor Lopez Casado
2013-02-06 15:10                 ` Jiri Kosina
2013-02-06 15:21                   ` David Herrmann
  -- strict thread matches above, loose matches on Subject: below --
2013-02-10 17:47 Andrew de los Reyes
2013-02-11 15:42 ` David Herrmann
2013-02-11 17:55   ` Bruno Prémont
2013-02-11 19:13     ` Andrew de los Reyes
2013-02-11 21:05       ` Bruno Prémont
2013-02-14  5:08     ` Andrew de los Reyes
2013-02-14  7:06       ` Bruno Prémont
2013-02-17  1:43         ` Andrew de los Reyes
2013-02-14  5:07 Andrew de los Reyes
2013-02-18 13:08 ` Jiri Kosina
2013-02-25 13:03   ` Jiri Kosina
2013-02-25 13:09     ` David Herrmann
2013-02-25 13:15       ` Jiri Kosina
2013-02-25 17:16         ` Andrew de los Reyes

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='CAN+gG=ENOU1oYRLd2ZMhPeCFPmTtiYRDZuuW3idvULShrnkPUg@mail.gmail.com' \
    --to=benjamin.tissoires@gmail.com \
    --cc=andrew-vger@gizmolabs.org \
    --cc=bonbons@linux-vserver.org \
    --cc=dh.herrmann@googlemail.com \
    --cc=jkosina@suse.cz \
    --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 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).