linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Pavel Machek <pavel@ucw.cz>
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 16:53:39 +0200	[thread overview]
Message-ID: <a371a9fc-5dfc-96ad-f4ff-766e27776d7b@samsung.com> (raw)
In-Reply-To: <20160915124103.GF13132@amd>

Hi Pavel,

On 09/15/2016 02:41 PM, Pavel Machek wrote:
> 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/?

I see python scripts only in perf tools. Let's stay by C application.

David, could you please prepare another version of the patch, that
splits test app code to the separate file in tools/leds (the directory
doesn't exist so far), also providing suitable Makefile?

>>> 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...

Good point.

-- 
Best regards,
Jacek Anaszewski

      reply	other threads:[~2016-09-15 14:53 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
2016-09-15 14:53     ` Jacek Anaszewski [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=a371a9fc-5dfc-96ad-f4ff-766e27776d7b@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=david@lechnology.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=pavel@ucw.cz \
    --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).