From: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
To: Dave Stevens <geek@uniserve.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: maintainer for this update?
Date: Thu, 28 Mar 2019 23:22:26 -0400 [thread overview]
Message-ID: <14034.1553829746@turing-police> (raw)
In-Reply-To: <20190328145328.61fa7f95@dave-900X1B>
On Thu, 28 Mar 2019 14:53:28 -0700, Dave Stevens said:
> In the article below about kernel updates is a reference to a driver for
> a Plantower PMS7003 particulate matter sensor. I'm using this series in
> air pollution monitoring and its usual interface to the computer
> is over a serial line. I consequently am very curious about how and why
> it would need a specific kernel module.
A quick look at the driver shows that it apparently does at least
a little bit of the heavy lifting for you - rather than you have to do all the
serial I/O interpretation yourself in userspace, it will handle checksums and
channels and so on for you.
+enum pms7003_cmd {
+ CMD_WAKEUP,
+ CMD_ENTER_PASSIVE_MODE,
+ CMD_READ_PASSIVE,
+ CMD_SLEEP,
+};
+
+/*
+ * commands have following format:
+ *
+ * +------+------+-----+------+-----+-----------+-----------+
+ * | 0x42 | 0x4d | cmd | 0x00 | arg | cksum msb | cksum lsb |
+ * +------+------+-----+------+-----+-----------+-----------+
+ */
+static const u8 pms7003_cmd_tbl[][PMS7003_CMD_LENGTH] = {
+ [CMD_WAKEUP] = { 0x42, 0x4d, 0xe4, 0x00, 0x01, 0x01, 0x74 },
+ [CMD_ENTER_PASSIVE_MODE] = { 0x42, 0x4d, 0xe1, 0x00, 0x00, 0x01, 0x70 },
+ [CMD_READ_PASSIVE] = { 0x42, 0x4d, 0xe2, 0x00, 0x00, 0x01, 0x71 },
+ [CMD_SLEEP] = { 0x42, 0x4d, 0xe4, 0x00, 0x00, 0x01, 0x73 },
+};
So you can send 'wakeup' or 'read' and it will send the strings, and
then read back data and complete the I/O when enough bytes have
arrived.
There's also some probing in there to deal with device tree etc.
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
prev parent reply other threads:[~2019-03-29 3:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 21:53 maintainer for this update? Dave Stevens
2019-03-28 22:28 ` Greg KH
2019-03-29 3:22 ` Valdis Klētnieks [this message]
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=14034.1553829746@turing-police \
--to=valdis.kletnieks@vt.edu \
--cc=geek@uniserve.com \
--cc=kernelnewbies@kernelnewbies.org \
/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;
as well as URLs for NNTP newsgroup(s).