From: David Fries <David@fries.net>
To: Richard Weinberger <richard@nod.at>
Cc: Mariusz Gorski <marius.gorski@gmail.com>,
Evgeniy Polyakov <zbr@ioremap.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/2] w1: slaves: w1_therm: Add sysfs entry for current temperature
Date: Tue, 6 Jan 2015 20:27:54 -0600 [thread overview]
Message-ID: <20150107022754.GA14458@spacedout.fries.net> (raw)
In-Reply-To: <54AC1258.2070004@nod.at>
On Tue, Jan 06, 2015 at 05:50:32PM +0100, Richard Weinberger wrote:
> Am 06.01.2015 um 17:12 schrieb Mariusz Gorski:
> > On Tue, Jan 06, 2015 at 04:01:47PM +0100, Richard Weinberger wrote:
> >> On Tue, Jan 6, 2015 at 3:29 PM, Mariusz Gorski <marius.gorski@gmail.com> wrote:
> >>> DS18B20 and it's brothers are pretty popular in the RaspberryPi world
> >>> when it comes to temperature measurement. All tutorials on the Internet
> >>> use the same way of parsing the output of the w1_slave sysfs file.
> >>> These patches add a dedicated sysfs entry called 'temp' whose only job
> >>> is to output the current temperature.
> >>
> >> And what is the benefit of this patches?
> >
> > Well, instead of having to parse the output of w1_slave:
> >
> > $ cat w1_slave
> > 4d 01 55 00 7f ff 0c 10 fd : crc=fd YES
> > 4d 01 55 00 7f ff 0c 10 fd t=20812
> >
> > the userspace program gets only the interesting information,
> > which usually is the current temparture:
>
> A sane user would also check the CRC.
Yes, and more because all 00's will pass a checksum, but be an invalid
reading, because there will be some bit in there outside of the two
temperature return bytes that won't be 0, hence the temperature field
can't be trusted. All ff's will fail a checksum, but is useful to
know because that pretty much means the sensor is no longer there.
> IMHO it is up to the user to format the output for its needs.
> Some may want "20812", some "20.8", some else maybe "20.8°C".
> Let it up to the user.
> Any trivial awk/cut/etc... oneliner would do it.
I'm not fond of the format of w1_slave printing two sensor readings
and such, it's confusing. Back in the day (2008) I at least
standardized the t= converted value to millidegrees C. That was
because DS18B20 gave degrees C where DS18S20 gave millidegrees C, so
it's been worse.
> Thanks,
> //richard
--
David Fries <david@fries.net> PGP pub CB1EE8F0
http://fries.net/~david/
next prev parent reply other threads:[~2015-01-07 2:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 14:29 [PATCH 0/2] w1: slaves: w1_therm: Add sysfs entry for current temperature Mariusz Gorski
2015-01-06 14:29 ` [PATCH 1/2] w1: slaves: w1_therm: Extract read_rom function Mariusz Gorski
2015-01-06 14:29 ` [PATCH 2/2] w1: slaves: w1_therm: Add temp attribute Mariusz Gorski
2015-01-06 17:42 ` Greg Kroah-Hartman
2015-01-06 20:19 ` Mariusz Gorski
2015-01-06 20:26 ` Greg Kroah-Hartman
2015-01-07 2:00 ` David Fries
2015-01-06 15:01 ` [PATCH 0/2] w1: slaves: w1_therm: Add sysfs entry for current temperature Richard Weinberger
2015-01-06 16:12 ` Mariusz Gorski
2015-01-06 16:50 ` Richard Weinberger
2015-01-07 2:27 ` David Fries [this message]
2015-01-07 1:59 ` David Fries
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=20150107022754.GA14458@spacedout.fries.net \
--to=david@fries.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marius.gorski@gmail.com \
--cc=richard@nod.at \
--cc=zbr@ioremap.net \
/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