On Thu, Jan 19, 2017 at 11:56 AM, Jiri Kosina <ji...@kernel.org> wrote:
> On Wed, 18 Jan 2017, Benjamin Tissoires wrote:
>
>> > The current custom solution for the G920 is not the best because
>> > hid_hw_start() is not called at the end of the .probe().
>> > It means that any configuration retrieved after the initial hid_hw_start
>> > would not be exposed to user space without races.
>> >
>> > We can simply force hid_hw_start to just enable the transport layer by
>> > not using a connect_mask. This way, we can have a common path between
>> > USB, Unifying and Bluetooth devices.
>> >
>> > Tested with a G502 (plain USB), a T650 and many other unifying devices,
>> > and the T651 over Bluetooth.
>> >
>> > Signed-off-by: Benjamin Tissoires <benjamin.tissoi...@redhat.com>
>> > ---
>> >  drivers/hid/hid-logitech-hidpp.c | 88 
>> > ++++++++++++++++++++++------------------
>> >  1 file changed, 48 insertions(+), 40 deletions(-)
>> >
>> > diff --git a/drivers/hid/hid-logitech-hidpp.c 
>> > b/drivers/hid/hid-logitech-hidpp.c
>> > index a5d37a4..f5889ff 100644
>> > --- a/drivers/hid/hid-logitech-hidpp.c
>> > +++ b/drivers/hid/hid-logitech-hidpp.c
>> > @@ -2813,6 +2813,17 @@ static int hidpp_probe(struct hid_device *hdev, 
>> > const struct hid_device_id *id)
>> >         if (!hidpp_validate_device(hdev))
>> >                 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
>> >
>> > +       /*
>> > +        * HID++ needs to read incoming report while in .probe().
>> > +        * However, this doesn't work for plain USB devices until the hdev
>> > +        * status is set with HID_STAT_ADDED (device fully registered once
>> > +        * with HID).
>> > +        * So we ask for it to be reprobed later.
>> > +        */
>> > +       if (id->group != HID_GROUP_LOGITECH_DJ_DEVICE &&
>> > +           !(hdev->status & HID_STAT_ADDED))
>>
>> Looks like this test breaks the T651 (bluetooth) after all. I seem to
>> have better success with:
>>     if (id->bus == BUS_USB && !(hdev->status & HID_STAT_ADDED))
>>
>> But that also means that the solution will not work if there is only
>> one USB interface in the device :/
>
> Benjamin,
>
> do you want at least a subset of this patchset to be queued before you
> figure this out, or should I put the whole thing on hold? (not gone
> through it fully yet).
>

I think the first 11 patches (until "HID: logitech-hidpp: add a sysfs
file to tell we support power_supply" - included) should be good to go
while we get the test results and confirmation from others. The last
part of the series is really for non-unifying devices, but they are
not handled currently by upower, so it won't be a conflict to have
them now or later.

However, I'd like to get inputs from Bastien to see if that works for
him (I provided a test kenrel build for him to do the tests). I have
some doubts with the T650 as it appears in the main section of the
battery info instead of a separate device if you connect it while the
power panel is opened...

Cheers,
Benjamin

Reply via email to