From: Philipp Jungkamp <p.jungkamp@gmx.net>
To: Jiri Kosina <jikos@kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org, Philipp Jungkamp <p.jungkamp@gmx.net>
Subject: [PATCH] IIO: hid-sensor-prox: add missing scale attribute
Date: Sun, 6 Aug 2023 14:59:26 +0200 [thread overview]
Message-ID: <20230806130558.89812-2-p.jungkamp@gmx.net> (raw)
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
next reply other threads:[~2023-08-06 13:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-06 12:59 Philipp Jungkamp [this message]
2023-08-07 23:02 ` [PATCH] IIO: hid-sensor-prox: add missing scale attribute 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
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=20230806130558.89812-2-p.jungkamp@gmx.net \
--to=p.jungkamp@gmx.net \
--cc=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/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