Linux IIO development
 help / color / mirror / Atom feed
* [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; 14+ 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] 14+ messages in thread
* [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; 14+ 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] 14+ messages in thread

end of thread, other threads:[~2023-10-28 16:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-06 12:59 [PATCH] IIO: hid-sensor-prox: add missing scale attribute 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
  -- strict thread matches above, loose matches on Subject: below --
2022-12-22 12:07 Philipp Jungkamp
2022-12-23 14:07 ` Jonathan Cameron
2023-01-02 16:43 ` srinivas pandruvada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox