linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: David Lechner <david@lechnology.com>,
	Richard Purdie <rpurdie@rpsys.net>,
	linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
	Marcel Holtmann <marcel@holtmann.org>
Subject: Re: [PATCH] leds: Introduce userspace leds driver
Date: Thu, 15 Sep 2016 14:41:03 +0200	[thread overview]
Message-ID: <20160915124103.GF13132@amd> (raw)
In-Reply-To: <04c5ee0d-9bfb-6e0a-2616-6cf720fc8763@samsung.com>

Hi!

> Thanks for the patch. It is very nice. I have only one minor remark
> in the code.
> 
> I think that it would be good to add a documentation for this
> driver to Documentation/leds, with exemplary C program instead
> of python one. The program could poll the dev node in a loop,
> which allows to conveniently check the impact of setting particular
> triggers and all other brightness change events.

Actually, I'd say that python is fine -- it is used heavily in tools/.

But perhaps the example program should go to tools/?

> >def change_brightness(b):
> >    with open('/sys/class/leds/{}/brightness'.format(name) , 'w') as f:
> >       f.write(str(b))
> >
> >
> >with open('/dev/uleds', 'rb+', 0) as uleds:
> >    bname = name.encode("ascii")
> >    # create the leds class device
> >    uleds.write(bname + b'\0' * (ULEDS_MAX_NAME_SIZE - len(bname)))

Umm. I don't see it in the kernel code. You let userspace provide a
LED name?

Where is the LED name tested for sanity? I guess there could be a lot
of fun naming a led ".." for example...

Best regards,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2016-09-15 12:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-06  2:15 [PATCH] leds: Introduce userspace leds driver David Lechner
2016-09-06  5:09 ` Peter Meerwald-Stadler
2016-09-06 15:21   ` David Lechner
2016-09-08  9:58 ` Jacek Anaszewski
2016-09-15 12:41   ` Pavel Machek [this message]
2016-09-15 14:53     ` Jacek Anaszewski

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=20160915124103.GF13132@amd \
    --to=pavel@ucw.cz \
    --cc=david@lechnology.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=rpurdie@rpsys.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;
as well as URLs for NNTP newsgroup(s).