lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAO-hwJ+RDnukVhL1=PirK=hU7gm2t73xsg=aDss0M9hj_CSuHA@mail.gmail.com>
Date: Fri, 22 Dec 2023 14:28:12 +0100
From: Benjamin Tissoires <benjamin.tissoires@...hat.com>
To: srinivas pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc: Yauhen Kharuzhy <jekhor@...il.com>, Jonathan Cameron <jic23@...nel.org>, linux-input@...r.kernel.org, 
	linux-iio@...r.kernel.org, Daniel Thompson <daniel.thompson@...aro.org>, 
	linux-kernel@...r.kernel.org, Jiri Kosina <jikos@...nel.org>
Subject: Re: [PATCH] HID: sensor-hub: Enable hid core report processing for
 all devices

On Fri, Dec 22, 2023 at 1:44 PM srinivas pandruvada
<srinivas.pandruvada@...ux.intel.com> wrote:
>
> On Wed, 2023-12-20 at 17:04 +0200, Yauhen Kharuzhy wrote:
> > ср, 20 дек. 2023 г. в 16:52, Jonathan Cameron <jic23@...nel.org>:
> > >
> > > On Wed, 20 Dec 2023 01:15:03 +0200
> > > Yauhen Kharuzhy <jekhor@...il.com> wrote:
> > >
> > > > After the commit 666cf30a589a ("HID: sensor-hub: Allow multi-
> > > > function
> > > > sensor devices") hub devices are claimed by hidraw driver in
> > > > hid_connect().
> > > > This causes stoppping of processing HID reports by hid core due
> > > > to
> > > > optimization.
> > > >
> > > > In such case, the hid-sensor-custom driver cannot match a known
> > > > custom
> > > > sensor in hid_sensor_custom_get_known() because it try to check
> > > > custom
> > > > properties which weren't filled from the report because hid core
> > > > didn't
> > > > parsed it.
> > > >
> > > > As result, custom sensors like hinge angle sensor and LISS
> > > > sensors
> > > > don't work.
> > > >
> > > > Mark the sensor hub devices claimed by some driver to avoid
> > > > hidraw-related
> > > > optimizations.
> > > >
> > > > Signed-off-by: Yauhen Kharuzhy <jekhor@...il.com>
> > > Fixes tag?
> >
> > Fixes: 666cf30a589a ("HID: sensor-hub: Allow multi-function sensor
> > devices")
> >
> This flag causes
>                 hdev->claimed |= HID_CLAIMED_DRIVER;
> I don't see the flag is used anywhere after this assignment in hid
> core. Only two other drivers are setting this flag. We need Jiri's help
> here why this is a special case.

It's used in hid_report_raw_event()[0]:
```
    if (hid->claimed != HID_CLAIMED_HIDRAW && report->maxfield) {
        hid_process_report(hid, report, cdata, interrupt);
        hdrv = hid->driver;
        if (hdrv && hdrv->report)
            hdrv->report(hid, report);
    }
```

The whole point of setting HID_CLAIMED_DRIVER is to have hid->claimed
not equal to HID_CLAIMED_HIDRAW, in case we need the hid core
processing.

Cheers,
Benjamin


[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/hid/hid-core.c#n2015

>
> Thanks,
> Srinivas
>
> > >
> > > > ---
> > > >  drivers/hid/hid-sensor-hub.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-
> > > > sensor-hub.c
> > > > index 2eba152e8b90..26e93a331a51 100644
> > > > --- a/drivers/hid/hid-sensor-hub.c
> > > > +++ b/drivers/hid/hid-sensor-hub.c
> > > > @@ -632,7 +632,7 @@ static int sensor_hub_probe(struct hid_device
> > > > *hdev,
> > > >       }
> > > >       INIT_LIST_HEAD(&hdev->inputs);
> > > >
> > > > -     ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
> > > > +     ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT |
> > > > HID_CONNECT_DRIVER);
> > > >       if (ret) {
> > > >               hid_err(hdev, "hw start failed\n");
> > > >               return ret;
> > >
> >
> >
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ