Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1484125 > unrolled thread
| Started by | Pavel Machek <pavel@ucw.cz> |
|---|---|
| First post | 2016-09-15 14:50 +0200 |
| Last post | 2016-09-15 17:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] leds: Introduce userspace leds driver Pavel Machek <pavel@ucw.cz> - 2016-09-15 14:50 +0200
Re: [PATCH] leds: Introduce userspace leds driver Jacek Anaszewski <j.anaszewski@samsung.com> - 2016-09-15 17:00 +0200
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-09-15 14:50 +0200 |
| Subject | Re: [PATCH] leds: Introduce userspace leds driver |
| Message-ID | <shEh3-75Z-9@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Jacek Anaszewski <j.anaszewski@samsung.com> |
|---|---|
| Date | 2016-09-15 17:00 +0200 |
| Message-ID | <shGiR-8jb-15@gated-at.bofh.it> |
| In reply to | #1484125 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web