* [PATCH] IIO: hid-sensor-prox: add missing scale attribute
@ 2022-12-22 12:07 Philipp Jungkamp
2022-12-23 14:07 ` Jonathan Cameron
2023-01-02 16:43 ` srinivas pandruvada
0 siblings, 2 replies; 13+ messages in thread
From: Philipp Jungkamp @ 2022-12-22 12:07 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada,
Lars-Peter Clausen
Cc: linux-input, linux-iio, Philipp Jungkamp
The hid-sensor-prox returned an empty string on sysfs in_proximity_scale
read. This is due to the the drivers reporting it's scale from an
internal value which is never changed from zero.
Try to query the scale of the HID sensor using hid_sensor_format_scale.
Signed-off-by: Philipp Jungkamp <p.jungkamp@gmx.net>
---
Hello,
While trying to utilize hid_sensor_prox driver I noticed this problem.
Should this be part of the branch created for the other patch series I
have submitted?
See: https://lore.kernel.org/linux-iio/nycvar.YFH.7.76.2212201525010.9000@cbobk.fhfr.pm/T/#u
Regards,
Philipp Jungkamp
drivers/iio/light/hid-sensor-prox.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index f10fa2abfe72..3322f8e56f41 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -222,6 +222,9 @@ static int prox_parse_report(struct platform_device *pdev,
dev_dbg(&pdev->dev, "prox %x:%x\n", st->prox_attr.index,
st->prox_attr.report_id);
+ st->scale_precision = hid_sensor_format_scale(usage_id, &st->prox_attr,
+ &st->scale_pre_decml, &st->scale_post_decml);
+
return ret;
}
--
2.39.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2022-12-22 12:07 [PATCH] IIO: hid-sensor-prox: add missing scale attribute Philipp Jungkamp
@ 2022-12-23 14:07 ` Jonathan Cameron
2023-01-02 16:43 ` srinivas pandruvada
1 sibling, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2022-12-23 14:07 UTC (permalink / raw)
To: Philipp Jungkamp
Cc: Jiri Kosina, Srinivas Pandruvada, Lars-Peter Clausen, linux-input,
linux-iio
On Thu, 22 Dec 2022 13:07:42 +0100
Philipp Jungkamp <p.jungkamp@gmx.net> wrote:
> The hid-sensor-prox returned an empty string on sysfs in_proximity_scale
> read. This is due to the the drivers reporting it's scale from an
> internal value which is never changed from zero.
>
> Try to query the scale of the HID sensor using hid_sensor_format_scale.
>
> Signed-off-by: Philipp Jungkamp <p.jungkamp@gmx.net>
> ---
> Hello,
>
> While trying to utilize hid_sensor_prox driver I noticed this problem.
> Should this be part of the branch created for the other patch series I
> have submitted?
> See: https://lore.kernel.org/linux-iio/nycvar.YFH.7.76.2212201525010.9000@cbobk.fhfr.pm/T/#u
Don't worry about it. I'll pick this up and pull in the hid stuff Jiri
made available once Srinivas and others have had a chance to take a quick look
at it. Looks correct to me.
Jonathan
>
> Regards,
> Philipp Jungkamp
>
> drivers/iio/light/hid-sensor-prox.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
> index f10fa2abfe72..3322f8e56f41 100644
> --- a/drivers/iio/light/hid-sensor-prox.c
> +++ b/drivers/iio/light/hid-sensor-prox.c
> @@ -222,6 +222,9 @@ static int prox_parse_report(struct platform_device *pdev,
> dev_dbg(&pdev->dev, "prox %x:%x\n", st->prox_attr.index,
> st->prox_attr.report_id);
>
> + st->scale_precision = hid_sensor_format_scale(usage_id, &st->prox_attr,
> + &st->scale_pre_decml, &st->scale_post_decml);
> +
> return ret;
> }
>
> --
> 2.39.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2022-12-22 12:07 [PATCH] IIO: hid-sensor-prox: add missing scale attribute Philipp Jungkamp
2022-12-23 14:07 ` Jonathan Cameron
@ 2023-01-02 16:43 ` srinivas pandruvada
1 sibling, 0 replies; 13+ messages in thread
From: srinivas pandruvada @ 2023-01-02 16:43 UTC (permalink / raw)
To: Philipp Jungkamp, Jiri Kosina, Jonathan Cameron,
Lars-Peter Clausen
Cc: linux-input, linux-iio
On Thu, 2022-12-22 at 13:07 +0100, Philipp Jungkamp wrote:
> The hid-sensor-prox returned an empty string on sysfs
> in_proximity_scale
> read. This is due to the the drivers reporting it's scale from an
> internal value which is never changed from zero.
>
> Try to query the scale of the HID sensor using
> hid_sensor_format_scale.
By spec there is no unit for this attribute:
"
An application-level or physical collection that identifies
a device that detects human presence (Boolean yes or no).
"
There is no use of calling hid_sensor_format_scale() as there is no
conversion. With the call this is setting scale_pre_decml to 1.
Better to set scale_pre_decml to 1 instead of calling
hid_sensor_format_scale(), which gives wrong impression that we are
converting to some scale.
Thanks,
Srinivas
>
> Signed-off-by: Philipp Jungkamp <p.jungkamp@gmx.net>
> ---
> Hello,
>
> While trying to utilize hid_sensor_prox driver I noticed this
> problem.
> Should this be part of the branch created for the other patch series
> I
> have submitted?
> See:
> https://lore.kernel.org/linux-iio/nycvar.YFH.7.76.2212201525010.9000@cbobk.fhfr.pm/T/#u
>
> Regards,
> Philipp Jungkamp
>
> drivers/iio/light/hid-sensor-prox.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/light/hid-sensor-prox.c
> b/drivers/iio/light/hid-sensor-prox.c
> index f10fa2abfe72..3322f8e56f41 100644
> --- a/drivers/iio/light/hid-sensor-prox.c
> +++ b/drivers/iio/light/hid-sensor-prox.c
> @@ -222,6 +222,9 @@ static int prox_parse_report(struct
> platform_device *pdev,
> dev_dbg(&pdev->dev, "prox %x:%x\n", st->prox_attr.index,
> st->prox_attr.report_id);
>
> + st->scale_precision = hid_sensor_format_scale(usage_id, &st-
> >prox_attr,
> + &st->scale_pre_decml, &st-
> >scale_post_decml);
> +
> return ret;
> }
>
> --
> 2.39.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] IIO: hid-sensor-prox: add missing scale attribute
@ 2023-08-06 12:59 Philipp Jungkamp
2023-08-07 23:02 ` srinivas pandruvada
0 siblings, 1 reply; 13+ messages in thread
From: Philipp Jungkamp @ 2023-08-06 12:59 UTC (permalink / raw)
To: Jiri Kosina, Jonathan Cameron, Srinivas Pandruvada,
Lars-Peter Clausen
Cc: linux-iio, Philipp Jungkamp
The hid-sensor-prox returned an empty string on sysfs in_proximity_scale
read. This is due to the the driver's scale never being initialized.
Try to query the scale of the HID sensor using hid_sensor_format_scale.
Signed-off-by: Philipp Jungkamp <p.jungkamp@gmx.net>
---
Hello,
up until now I've used the sensor directly through the buffered IIO interface,
ignoring the in_proximity_scale attribute. But while integrating it with
iio-sensor-proxy I noticed that a read on scale return an empty string,
breaking the code there.
Looking at the code in `hid-sensor-prox.c` it is fairly obvious that the scale
just wasn't being initialized. I now added the hid_sensor_format_scale call
similar to the ones found in e.g. `hid-sensor-als.c`.
Regards,
Philipp Jungkamp
drivers/iio/light/hid-sensor-prox.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index a47591e1bad9..aaf2ce6ed52c 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -227,6 +227,9 @@ static int prox_parse_report(struct platform_device *pdev,
dev_dbg(&pdev->dev, "prox %x:%x\n", st->prox_attr.index,
st->prox_attr.report_id);
+ st->scale_precision = hid_sensor_format_scale(usage_id, &st->prox_attr,
+ &st->scale_pre_decml, &st->scale_post_decml);
+
return ret;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-08-06 12:59 Philipp Jungkamp
@ 2023-08-07 23:02 ` srinivas pandruvada
2023-08-08 12:22 ` Aw: " Philipp Jungkamp
0 siblings, 1 reply; 13+ messages in thread
From: srinivas pandruvada @ 2023-08-07 23:02 UTC (permalink / raw)
To: Philipp Jungkamp, Jiri Kosina, Jonathan Cameron,
Lars-Peter Clausen
Cc: linux-iio
On Sun, 2023-08-06 at 14:59 +0200, Philipp Jungkamp wrote:
> The hid-sensor-prox returned an empty string on sysfs
> in_proximity_scale
> read. This is due to the the driver's scale never being initialized.
What is scale value reporting here? Is it 1.
Thanks,
Srinivas
>
> Try to query the scale of the HID sensor using
> hid_sensor_format_scale.
>
> Signed-off-by: Philipp Jungkamp <p.jungkamp@gmx.net>
> ---
> Hello,
>
> up until now I've used the sensor directly through the buffered IIO
> interface,
> ignoring the in_proximity_scale attribute. But while integrating it
> with
> iio-sensor-proxy I noticed that a read on scale return an empty
> string,
> breaking the code there.
>
> Looking at the code in `hid-sensor-prox.c` it is fairly obvious that
> the scale
> just wasn't being initialized. I now added the
> hid_sensor_format_scale call
> similar to the ones found in e.g. `hid-sensor-als.c`.
>
> Regards,
> Philipp Jungkamp
>
> drivers/iio/light/hid-sensor-prox.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/light/hid-sensor-prox.c
> b/drivers/iio/light/hid-sensor-prox.c
> index a47591e1bad9..aaf2ce6ed52c 100644
> --- a/drivers/iio/light/hid-sensor-prox.c
> +++ b/drivers/iio/light/hid-sensor-prox.c
> @@ -227,6 +227,9 @@ static int prox_parse_report(struct
> platform_device *pdev,
> dev_dbg(&pdev->dev, "prox %x:%x\n", st->prox_attr.index,
> st->prox_attr.report_id);
>
> + st->scale_precision = hid_sensor_format_scale(usage_id, &st-
> >prox_attr,
> + &st->scale_pre_decml, &st-
> >scale_post_decml);
> +
> return ret;
> }
>
> --
> 2.41.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Aw: Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-08-07 23:02 ` srinivas pandruvada
@ 2023-08-08 12:22 ` Philipp Jungkamp
2023-10-14 16:52 ` Jonathan Cameron
0 siblings, 1 reply; 13+ messages in thread
From: Philipp Jungkamp @ 2023-08-08 12:22 UTC (permalink / raw)
To: srinivas pandruvada
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen, linux-iio
> > The hid-sensor-prox returned an empty string on sysfs
> > in_proximity_scale
> > read. This is due to the the driver's scale never being initialized.
>
> What is scale value reporting here? Is it 1.
>
> Thanks,
> Srinivas
Calling `read` on the sysfs file `in_proximity_scale` returns 0, thus an empty string.
Adding the hid_format_scale call makes that a '1.000000'.
Regards,
Philipp
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-08-08 12:22 ` Aw: " Philipp Jungkamp
@ 2023-10-14 16:52 ` Jonathan Cameron
2023-10-15 2:56 ` srinivas pandruvada
0 siblings, 1 reply; 13+ messages in thread
From: Jonathan Cameron @ 2023-10-14 16:52 UTC (permalink / raw)
To: Philipp Jungkamp
Cc: srinivas pandruvada, Jiri Kosina, Lars-Peter Clausen, linux-iio
On Tue, 8 Aug 2023 14:22:10 +0200
Philipp Jungkamp <p.jungkamp@gmx.net> wrote:
> > > The hid-sensor-prox returned an empty string on sysfs
> > > in_proximity_scale
> > > read. This is due to the the driver's scale never being initialized.
> >
> > What is scale value reporting here? Is it 1.
> >
> > Thanks,
> > Srinivas
>
> Calling `read` on the sysfs file `in_proximity_scale` returns 0, thus an empty string.
> Adding the hid_format_scale call makes that a '1.000000'.
>
> Regards,
> Philipp
Srinivas - I was kind of waiting for a reply to say if you are happy with the explanation.
All good?
Phillipp - this sounds like a fix to me. Fixes tag?
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-10-14 16:52 ` Jonathan Cameron
@ 2023-10-15 2:56 ` srinivas pandruvada
2023-10-15 11:04 ` Jonathan Cameron
0 siblings, 1 reply; 13+ messages in thread
From: srinivas pandruvada @ 2023-10-15 2:56 UTC (permalink / raw)
To: Jonathan Cameron, Philipp Jungkamp
Cc: Jiri Kosina, Lars-Peter Clausen, linux-iio
On Sat, 2023-10-14 at 17:52 +0100, Jonathan Cameron wrote:
> On Tue, 8 Aug 2023 14:22:10 +0200
> Philipp Jungkamp <p.jungkamp@gmx.net> wrote:
>
> > > > The hid-sensor-prox returned an empty string on sysfs
> > > > in_proximity_scale
> > > > read. This is due to the the driver's scale never being
> > > > initialized.
> > >
> > > What is scale value reporting here? Is it 1.
> > >
> > > Thanks,
> > > Srinivas
> >
> > Calling `read` on the sysfs file `in_proximity_scale` returns 0,
> > thus an empty string.
> > Adding the hid_format_scale call makes that a '1.000000'.
> >
> > Regards,
> > Philipp
>
> Srinivas - I was kind of waiting for a reply to say if you are happy
> with the explanation.
> All good?
All good.
Acked-by: Srinivas Pandruvada<srinivas.pandruvada@linux.intel.com>
>
> Phillipp - this sounds like a fix to me. Fixes tag?
>
> Thanks,
>
> Jonathan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-10-15 2:56 ` srinivas pandruvada
@ 2023-10-15 11:04 ` Jonathan Cameron
2023-10-16 7:44 ` Jonathan Cameron
0 siblings, 1 reply; 13+ messages in thread
From: Jonathan Cameron @ 2023-10-15 11:04 UTC (permalink / raw)
To: srinivas pandruvada
Cc: Philipp Jungkamp, Jiri Kosina, Lars-Peter Clausen, linux-iio
On Sat, 14 Oct 2023 19:56:26 -0700
srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
> On Sat, 2023-10-14 at 17:52 +0100, Jonathan Cameron wrote:
> > On Tue, 8 Aug 2023 14:22:10 +0200
> > Philipp Jungkamp <p.jungkamp@gmx.net> wrote:
> >
> > > > > The hid-sensor-prox returned an empty string on sysfs
> > > > > in_proximity_scale
> > > > > read. This is due to the the driver's scale never being
> > > > > initialized.
> > > >
> > > > What is scale value reporting here? Is it 1.
> > > >
> > > > Thanks,
> > > > Srinivas
> > >
> > > Calling `read` on the sysfs file `in_proximity_scale` returns 0,
> > > thus an empty string.
> > > Adding the hid_format_scale call makes that a '1.000000'.
> > >
> > > Regards,
> > > Philipp
> >
> > Srinivas - I was kind of waiting for a reply to say if you are happy
> > with the explanation.
> > All good?
> All good.
>
> Acked-by: Srinivas Pandruvada<srinivas.pandruvada@linux.intel.com>
>
Given we are late in the cycle and my next fixes pull will probably end up
going in during the merge window anyway, I've applied this to the togreg
branch of iio.git (so the slow path).
Phillipp, if a backport makes sense you can request that after this
goes upstream.
Thanks,
Jonathan
> >
> > Phillipp - this sounds like a fix to me. Fixes tag?
> >
> > Thanks,
> >
> > Jonathan
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-10-15 11:04 ` Jonathan Cameron
@ 2023-10-16 7:44 ` Jonathan Cameron
2023-10-16 14:28 ` srinivas pandruvada
0 siblings, 1 reply; 13+ messages in thread
From: Jonathan Cameron @ 2023-10-16 7:44 UTC (permalink / raw)
To: srinivas pandruvada
Cc: Philipp Jungkamp, Jiri Kosina, Lars-Peter Clausen, linux-iio
On Sun, 15 Oct 2023 12:04:48 +0100
Jonathan Cameron <jic23@kernel.org> wrote:
> On Sat, 14 Oct 2023 19:56:26 -0700
> srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
>
> > On Sat, 2023-10-14 at 17:52 +0100, Jonathan Cameron wrote:
> > > On Tue, 8 Aug 2023 14:22:10 +0200
> > > Philipp Jungkamp <p.jungkamp@gmx.net> wrote:
> > >
> > > > > > The hid-sensor-prox returned an empty string on sysfs
> > > > > > in_proximity_scale
> > > > > > read. This is due to the the driver's scale never being
> > > > > > initialized.
> > > > >
> > > > > What is scale value reporting here? Is it 1.
> > > > >
> > > > > Thanks,
> > > > > Srinivas
> > > >
> > > > Calling `read` on the sysfs file `in_proximity_scale` returns 0,
> > > > thus an empty string.
> > > > Adding the hid_format_scale call makes that a '1.000000'.
> > > >
> > > > Regards,
> > > > Philipp
> > >
> > > Srinivas - I was kind of waiting for a reply to say if you are happy
> > > with the explanation.
> > > All good?
> > All good.
> >
> > Acked-by: Srinivas Pandruvada<srinivas.pandruvada@linux.intel.com>
> >
> Given we are late in the cycle and my next fixes pull will probably end up
> going in during the merge window anyway, I've applied this to the togreg
> branch of iio.git (so the slow path).
>
> Phillipp, if a backport makes sense you can request that after this
> goes upstream.
Whilst typing up a pull request I saw this again and thought a bit more on it.
This fix is probably wrong approach. Proximity sensors are often scale free
because they depend on reflectance off something or a capacitance changing etc
so we don't know the scaling. So the right response then is not to return a scale
value of 1.0 but to not provide the attribute at all. Is that something that
could be easily done here?
For now I'm dropping the patch. Sorry I wasn't paying enough attention to notice
this was a proximity sensor.
Jonathan
>
> Thanks,
>
> Jonathan
>
> > >
> > > Phillipp - this sounds like a fix to me. Fixes tag?
> > >
> > > Thanks,
> > >
> > > Jonathan
> >
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-10-16 7:44 ` Jonathan Cameron
@ 2023-10-16 14:28 ` srinivas pandruvada
2023-10-17 19:11 ` Jonathan Cameron
0 siblings, 1 reply; 13+ messages in thread
From: srinivas pandruvada @ 2023-10-16 14:28 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Philipp Jungkamp, Jiri Kosina, Lars-Peter Clausen, linux-iio
On Mon, 2023-10-16 at 08:44 +0100, Jonathan Cameron wrote:
> On Sun, 15 Oct 2023 12:04:48 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
>
> > On Sat, 14 Oct 2023 19:56:26 -0700
> > srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
> >
> > > On Sat, 2023-10-14 at 17:52 +0100, Jonathan Cameron wrote:
> > >
> >
[...]
> > Phillipp, if a backport makes sense you can request that after this
> > goes upstream.
> Whilst typing up a pull request I saw this again and thought a bit
> more on it.
>
> This fix is probably wrong approach. Proximity sensors are often
> scale free
> because they depend on reflectance off something or a capacitance
> changing etc
> so we don't know the scaling. So the right response then is not to
> return a scale
> value of 1.0 but to not provide the attribute at all. Is that
> something that
> could be easily done here?
I think so. But hope that iio-sensor-proxy can handle absence of scale
attribute.
git diff drivers/iio/light/hid-sensor-prox.c
diff --git a/drivers/iio/light/hid-sensor-prox.c
b/drivers/iio/light/hid-sensor-prox.c
index a47591e1bad9..e4b81fa948f5 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -36,7 +36,6 @@ static const struct iio_chan_spec prox_channels[] = {
.type = IIO_PROXIMITY,
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
- BIT(IIO_CHAN_INFO_SCALE) |
BIT(IIO_CHAN_INFO_SAMP_FREQ) |
BIT(IIO_CHAN_INFO_HYSTERESIS),
.scan_index = CHANNEL_SCAN_INDEX_PRESENCE,
Thanks,
Srinivas
>
> For now I'm dropping the patch. Sorry I wasn't paying enough
> attention to notice
> this was a proximity sensor.
>
> Jonathan
>
> >
> > Thanks,
> >
> > Jonathan
> >
> > > >
> > > > Phillipp - this sounds like a fix to me. Fixes tag?
> > > >
> > > > Thanks,
> > > >
> > > > Jonathan
> > >
> >
>
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-10-16 14:28 ` srinivas pandruvada
@ 2023-10-17 19:11 ` Jonathan Cameron
2023-10-18 1:56 ` srinivas pandruvada
0 siblings, 1 reply; 13+ messages in thread
From: Jonathan Cameron @ 2023-10-17 19:11 UTC (permalink / raw)
To: srinivas pandruvada
Cc: Philipp Jungkamp, Jiri Kosina, Lars-Peter Clausen, linux-iio
On Mon, 16 Oct 2023 07:28:36 -0700
srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
> On Mon, 2023-10-16 at 08:44 +0100, Jonathan Cameron wrote:
> > On Sun, 15 Oct 2023 12:04:48 +0100
> > Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > > On Sat, 14 Oct 2023 19:56:26 -0700
> > > srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
> > >
> > > > On Sat, 2023-10-14 at 17:52 +0100, Jonathan Cameron wrote:
> > > >
> > >
>
> [...]
>
> > > Phillipp, if a backport makes sense you can request that after this
> > > goes upstream.
> > Whilst typing up a pull request I saw this again and thought a bit
> > more on it.
> >
> > This fix is probably wrong approach. Proximity sensors are often
> > scale free
> > because they depend on reflectance off something or a capacitance
> > changing etc
> > so we don't know the scaling. So the right response then is not to
> > return a scale
> > value of 1.0 but to not provide the attribute at all. Is that
> > something that
> > could be easily done here?
>
> I think so. But hope that iio-sensor-proxy can handle absence of scale
> attribute.
>
> git diff drivers/iio/light/hid-sensor-prox.c
> diff --git a/drivers/iio/light/hid-sensor-prox.c
> b/drivers/iio/light/hid-sensor-prox.c
> index a47591e1bad9..e4b81fa948f5 100644
> --- a/drivers/iio/light/hid-sensor-prox.c
> +++ b/drivers/iio/light/hid-sensor-prox.c
> @@ -36,7 +36,6 @@ static const struct iio_chan_spec prox_channels[] = {
> .type = IIO_PROXIMITY,
> .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
> - BIT(IIO_CHAN_INFO_SCALE) |
> BIT(IIO_CHAN_INFO_SAMP_FREQ) |
> BIT(IIO_CHAN_INFO_HYSTERESIS),
> .scan_index = CHANNEL_SCAN_INDEX_PRESENCE,
>
> Thanks,
> Srinivas
Just to check. Are we guaranteed that there is never a scale parameter?
Some proximity sensors do have absolute units (time of flight sensors
for example).
Jonathan
>
> >
> > For now I'm dropping the patch. Sorry I wasn't paying enough
> > attention to notice
> > this was a proximity sensor.
> >
> > Jonathan
> >
> > >
> > > Thanks,
> > >
> > > Jonathan
> > >
> > > > >
> > > > > Phillipp - this sounds like a fix to me. Fixes tag?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Jonathan
> > > >
> > >
> >
>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-10-17 19:11 ` Jonathan Cameron
@ 2023-10-18 1:56 ` srinivas pandruvada
2023-10-28 16:30 ` Jonathan Cameron
0 siblings, 1 reply; 13+ messages in thread
From: srinivas pandruvada @ 2023-10-18 1:56 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Philipp Jungkamp, Jiri Kosina, Lars-Peter Clausen, linux-iio
On Tue, 2023-10-17 at 20:11 +0100, Jonathan Cameron wrote:
> On Mon, 16 Oct 2023 07:28:36 -0700
> srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
>
> > On Mon, 2023-10-16 at 08:44 +0100, Jonathan Cameron wrote:
> > > On Sun, 15 Oct 2023 12:04:48 +0100
> > > Jonathan Cameron <jic23@kernel.org> wrote:
> > >
> > > > On Sat, 14 Oct 2023 19:56:26 -0700
> > > > srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
> > > > wrote:
> > > >
> > > > > On Sat, 2023-10-14 at 17:52 +0100, Jonathan Cameron wrote:
> > > > >
> > > >
> >
> > [...]
> >
> > > > Phillipp, if a backport makes sense you can request that after
> > > > this
> > > > goes upstream.
> > > Whilst typing up a pull request I saw this again and thought a
> > > bit
> > > more on it.
> > >
> > > This fix is probably wrong approach. Proximity sensors are often
> > > scale free
> > > because they depend on reflectance off something or a capacitance
> > > changing etc
> > > so we don't know the scaling. So the right response then is not
> > > to
> > > return a scale
> > > value of 1.0 but to not provide the attribute at all. Is that
> > > something that
> > > could be easily done here?
> >
> > I think so. But hope that iio-sensor-proxy can handle absence of
> > scale
> > attribute.
> >
> > git diff drivers/iio/light/hid-sensor-prox.c
> > diff --git a/drivers/iio/light/hid-sensor-prox.c
> > b/drivers/iio/light/hid-sensor-prox.c
> > index a47591e1bad9..e4b81fa948f5 100644
> > --- a/drivers/iio/light/hid-sensor-prox.c
> > +++ b/drivers/iio/light/hid-sensor-prox.c
> > @@ -36,7 +36,6 @@ static const struct iio_chan_spec prox_channels[]
> > = {
> > .type = IIO_PROXIMITY,
> > .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> > .info_mask_shared_by_type =
> > BIT(IIO_CHAN_INFO_OFFSET) |
> > - BIT(IIO_CHAN_INFO_SCALE) |
> > BIT(IIO_CHAN_INFO_SAMP_FREQ) |
> > BIT(IIO_CHAN_INFO_HYSTERESIS),
> > .scan_index = CHANNEL_SCAN_INDEX_PRESENCE,
> >
> > Thanks,
> > Srinivas
>
> Just to check. Are we guaranteed that there is never a scale
> parameter?
> Some proximity sensors do have absolute units (time of flight sensors
> for example).
>
This driver is implementing:
Biometric: Human Presence (Usage ID 0x11) from HID sensor hub
specification.
"Biometric: Human
PresenceCA,CP – An application-level or physical collection that
identifies
a device that detects human presence (Boolean yes or no)."
It is not implementing Biometric: Human Proximity (Usage ID 0x12).
This has range of values, then unit will be applicable.
Thanks,
Srinivas
> Jonathan
>
> >
> > >
> > > For now I'm dropping the patch. Sorry I wasn't paying enough
> > > attention to notice
> > > this was a proximity sensor.
> > >
> > > Jonathan
> > >
> > > >
> > > > Thanks,
> > > >
> > > > Jonathan
> > > >
> > > > > >
> > > > > > Phillipp - this sounds like a fix to me. Fixes tag?
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Jonathan
> > > > >
> > > >
> > >
> >
>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
2023-10-18 1:56 ` srinivas pandruvada
@ 2023-10-28 16:30 ` Jonathan Cameron
0 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2023-10-28 16:30 UTC (permalink / raw)
To: srinivas pandruvada
Cc: Philipp Jungkamp, Jiri Kosina, Lars-Peter Clausen, linux-iio
On Tue, 17 Oct 2023 18:56:38 -0700
srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
> On Tue, 2023-10-17 at 20:11 +0100, Jonathan Cameron wrote:
> > On Mon, 16 Oct 2023 07:28:36 -0700
> > srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote:
> >
> > > On Mon, 2023-10-16 at 08:44 +0100, Jonathan Cameron wrote:
> > > > On Sun, 15 Oct 2023 12:04:48 +0100
> > > > Jonathan Cameron <jic23@kernel.org> wrote:
> > > >
> > > > > On Sat, 14 Oct 2023 19:56:26 -0700
> > > > > srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
> > > > > wrote:
> > > > >
> > > > > > On Sat, 2023-10-14 at 17:52 +0100, Jonathan Cameron wrote:
> > > > > >
> > > > >
> > >
> > > [...]
> > >
> > > > > Phillipp, if a backport makes sense you can request that after
> > > > > this
> > > > > goes upstream.
> > > > Whilst typing up a pull request I saw this again and thought a
> > > > bit
> > > > more on it.
> > > >
> > > > This fix is probably wrong approach. Proximity sensors are often
> > > > scale free
> > > > because they depend on reflectance off something or a capacitance
> > > > changing etc
> > > > so we don't know the scaling. So the right response then is not
> > > > to
> > > > return a scale
> > > > value of 1.0 but to not provide the attribute at all. Is that
> > > > something that
> > > > could be easily done here?
> > >
> > > I think so. But hope that iio-sensor-proxy can handle absence of
> > > scale
> > > attribute.
> > >
> > > git diff drivers/iio/light/hid-sensor-prox.c
> > > diff --git a/drivers/iio/light/hid-sensor-prox.c
> > > b/drivers/iio/light/hid-sensor-prox.c
> > > index a47591e1bad9..e4b81fa948f5 100644
> > > --- a/drivers/iio/light/hid-sensor-prox.c
> > > +++ b/drivers/iio/light/hid-sensor-prox.c
> > > @@ -36,7 +36,6 @@ static const struct iio_chan_spec prox_channels[]
> > > = {
> > > .type = IIO_PROXIMITY,
> > > .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> > > .info_mask_shared_by_type =
> > > BIT(IIO_CHAN_INFO_OFFSET) |
> > > - BIT(IIO_CHAN_INFO_SCALE) |
> > > BIT(IIO_CHAN_INFO_SAMP_FREQ) |
> > > BIT(IIO_CHAN_INFO_HYSTERESIS),
> > > .scan_index = CHANNEL_SCAN_INDEX_PRESENCE,
> > >
> > > Thanks,
> > > Srinivas
> >
> > Just to check. Are we guaranteed that there is never a scale
> > parameter?
> > Some proximity sensors do have absolute units (time of flight sensors
> > for example).
> >
> This driver is implementing:
> Biometric: Human Presence (Usage ID 0x11) from HID sensor hub
> specification.
>
> "Biometric: Human
> PresenceCA,CP – An application-level or physical collection that
> identifies
> a device that detects human presence (Boolean yes or no)."
>
>
> It is not implementing Biometric: Human Proximity (Usage ID 0x12).
> This has range of values, then unit will be applicable.
Makes sense. In that case, formal version of the patch above?
Thanks,
Jonathan
>
> Thanks,
> Srinivas
>
> > Jonathan
> >
> > >
> > > >
> > > > For now I'm dropping the patch. Sorry I wasn't paying enough
> > > > attention to notice
> > > > this was a proximity sensor.
> > > >
> > > > Jonathan
> > > >
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Jonathan
> > > > >
> > > > > > >
> > > > > > > Phillipp - this sounds like a fix to me. Fixes tag?
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > > Jonathan
> > > > > >
> > > > >
> > > >
> > >
> >
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-10-28 16:31 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-22 12:07 [PATCH] IIO: hid-sensor-prox: add missing scale attribute Philipp Jungkamp
2022-12-23 14:07 ` Jonathan Cameron
2023-01-02 16:43 ` srinivas pandruvada
-- strict thread matches above, loose matches on Subject: below --
2023-08-06 12:59 Philipp Jungkamp
2023-08-07 23:02 ` srinivas pandruvada
2023-08-08 12:22 ` Aw: " Philipp Jungkamp
2023-10-14 16:52 ` Jonathan Cameron
2023-10-15 2:56 ` srinivas pandruvada
2023-10-15 11:04 ` Jonathan Cameron
2023-10-16 7:44 ` Jonathan Cameron
2023-10-16 14:28 ` srinivas pandruvada
2023-10-17 19:11 ` Jonathan Cameron
2023-10-18 1:56 ` srinivas pandruvada
2023-10-28 16:30 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox