Re: [PATCH 3/3] iio: chemical: add support for Sensirion SEN5x/SEN6x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2025/2/11 3:09, Jonathan Cameron wrote:
On Mon, 10 Feb 2025 17:16:57 +0800
Hermes Zhang <chenhuiz@xxxxxxxx> wrote:

Hi Jonathan,

Thanks a lot for your review. I will fix most of them in v2, just one
question below.

Best Regards,
Hermes


On 2025/2/9 0:15, Jonathan Cameron wrote:
On Thu, 6 Feb 2025 14:15:17 +0800
Hermes Zhang <Hermes.Zhang@xxxxxxxx> wrote:

+
+	state->last_update = jiffies;
+
+	return 0;
+}
+
+static ssize_t status_show(struct device *dev, struct device_attribute *attr,
+			   char *buf)
+{
+	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+	struct sen_common_state *state = iio_priv(indio_dev);
+	int status;
+	int ret;
+
+	ret = sen_common_status(state->client, &status);
This is custom ABI. So it would need documentation and will need
to overcome quite a high barrier.

Superficially this looks like debug perhaps that should be
in debugfs?
The status is one of the support commands from the chip, we (from
userspace) could read it and notify customer if the sensor is wrong or
not. So it is ued in normal usage, regarding the ABI, I see your point,
so instead of my way, do you have any suggestion for how to handle it in
iio? Thanks.
What is actually reporting?  I hope something more specific than
'wrong'.  Also when do you read it?  Standard software is never going to
so you may be better of doing some scheduled reading or reading it
on the back of a channel read.  Unfortunately the nature of failure modes
is that they are not easy to describe in a generic ABI - sometimes
our best bet is to just log an error (rate limited).

Some of these look like they mean the data read is garbage when they
are happening?

Jonathan

It's e.g. a 32bit data which some of the bits indicate if the PM/CO2/GAS/RHT/FAN is error. Yes, the software will scheduled to read it and deal the error based on some policy configurable (e.g reboot the device). I hope if the driver can provide such inteface to read it, so userspace can decide how to handle it. Is there some similar case already in driver now? Thanks.


Best Regards,

Hermes





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux