public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Fries <david@fries.net>
To: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: W1: w1_slave units, standardize 1C or .001C?  Break API
Date: Tue, 22 Jan 2008 22:00:51 -0600	[thread overview]
Message-ID: <20080123040050.GA26996@spacedout.fries.net> (raw)


On Wed, Jan 23, 2008 at 12:06:27AM +0300, Evgeniy Polyakov wrote:
> 
> What about instead of breaking application just add new sysfs file,
> which will only return temperature instead of full rom content.
> It can be millidegrees Centigrade, another one can be millikelvins :)

If someone wrote their application to read degrees C because they have
an ds18b20, the application will break anyway if they run it with an
ds1820 sensor.  Or the opposite way around.  Yes it would be better
not to break a program, but I think having a consistent interface for
both sensors to be a better option.

> Actually it is already posible for applications to decode whatever
> precision they like from the rom content displayed, although that can be
> not very convenient.

I was first surprised then glad that the raw data was included in the
user available data.  I was wanting the full precision, so that was my
plan.

> Even more, what about possibility of changing of the base, relative to
> which temperature is displayed? By default I vote for centigrades,
> those, who live behind the oceans, can setup Fahrenheit, Kelvin or anything
> else, but please in a new file :)
> David will this work for you?

I'm biased toward Fehrenheit, against Kelvin, but I think continuing
to keep Centigrade is the correct choice here.  I don't like the idea
of selecting the base the kernel displays by a userland option, too
easy to make assumptions, give it one interface and let the
application do the conversion, C/1000.0*9/5+32 is pretty easy (for
millidegrees C that is).

I'll get the trivial patch to change the ds18b20 output in
millidegrees C to make things consistent.  I'm out of time tonight.

It does sound like a good idea to have a sysfs file that just returns
the millidegrees C in ASCII without any other text.  It would be
easier to parse.  If the conversion fails return 0 bytes.  Just an
idea, but if someone wants it they can write the patch.

-- 
David Fries <david@fries.net>
http://fries.net/~david/ (PGP encryption key available)

             reply	other threads:[~2008-01-23  4:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-23  4:00 David Fries [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-01-21 23:15 W1: w1_slave units, standardize 1C or .001C? Break API David Fries
2008-01-22  1:08 ` H. Peter Anvin
2008-01-22  3:11   ` H. Peter Anvin
2008-01-22 21:07     ` Evgeniy Polyakov
2008-01-22 21:12       ` Evgeniy Polyakov
2008-01-23  4:09     ` David Fries
2008-01-23  4:22       ` H. Peter Anvin
2008-01-22 21:06 ` Evgeniy Polyakov

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=20080123040050.GA26996@spacedout.fries.net \
    --to=david@fries.net \
    --cc=hpa@zytor.com \
    --cc=johnpol@2ka.mipt.ru \
    --cc=linux-kernel@vger.kernel.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