All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: johannes@johannesthoma.com, linux-iio@vger.kernel.org
Subject: Re: [PATCH] HC-SR04 ultrasonic ranger IIO driver
Date: Tue, 7 Jun 2016 17:19:48 +0200	[thread overview]
Message-ID: <5756E614.5010508@metafoo.de> (raw)
In-Reply-To: <1465238418-26095-1-git-send-email-johannes@johannesthoma.com>

Hi,

Thanks for the patch.

On 06/06/2016 08:40 PM, johannes@johannesthoma.com wrote:
[...]
> + * To configure a device do a
> + *
> + *    mkdir /sys/kernel/config/iio/triggers/hc-sr04/sensor0
> + *
> + * (you need to mount configfs to /sys/kernel/config first unless it isn't
> + * mounted already)
> + *
> + * Then configure the ECHO and TRIG pins (this also accepts symbolic names
> + * configured in the device tree)
> + *
> + *    echo 23 > /config/iio/triggers/hc-sr04/sensor0/trig_pin
> + *    echo 24 > /config/iio/triggers/hc-sr04/sensor0/echo_pin
> + *
> + * Then you can measure distance with:
> + *
> + *    cat /sys/devices/trigger0/measure
> + *
> + * (trigger0 is the device name as reported by
> + *  /config/iio/triggers/hc-sr04/sensor0/dev_name

Any new ABI needs to be documented in Documentation/ABI/...

But to take one thing ahead passing the GPIO number (or a label) from
userspace is not really a good ABI in my opinion. The GPIO numbers should
come from the hardware description (DTS, ACPI, board file, ...)

> +	do_gettimeofday(&now);

gettimeofday is not a good function if you want to measure elapsed time
since the returned value jumps around when the system time is changed. Try
to use one of the monotonic time sources, those are guaranteed not to jump
around.

  parent reply	other threads:[~2016-06-07 15:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 18:40 [PATCH] HC-SR04 ultrasonic ranger IIO driver johannes
2016-06-07  5:42 ` Matt Ranostay
2016-06-07 11:44 ` Crt Mori
2016-06-07 15:19 ` Lars-Peter Clausen [this message]
2016-06-10  5:35   ` Johannes Thoma
2016-06-10  7:50     ` Lars-Peter Clausen
2016-06-11 15:20 ` Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2016-03-24 15:24 [PATCH] misc devices: HC-SRO4 ultrasonic distance driver Greg KH
2016-05-31 21:05 ` [PATCH] HC-SR04 ultrasonic ranger IIO driver johannes at johannesthoma.com
2016-05-31 21:10   ` Johannes Thoma
2016-05-31 21:35   ` Greg KH
2016-06-01  1:02   ` Valdis.Kletnieks at vt.edu
2016-06-01 14:56   ` Daniel Baluta

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=5756E614.5010508@metafoo.de \
    --to=lars@metafoo.de \
    --cc=johannes@johannesthoma.com \
    --cc=linux-iio@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.