[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMbhsRTjEn4ZSir-N2DX5HM9fueagAXpDFnx8OpPM2m6hgOXXQ@mail.gmail.com>
Date: Fri, 20 Jul 2012 22:14:27 -0700
From: Colin Cross <ccross@...roid.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Bryan Wu <bryan.wu@...onical.com>,
Richard Purdie <rpurdie@...ys.net>
Subject: Re: sysfs permissions on dynamic attributes (led delay_on and delay_off)
On Fri, Jul 20, 2012 at 9:08 PM, Greg KH <gregkh@...uxfoundation.org> wrote:
> On Fri, Jul 20, 2012 at 05:46:14PM -0700, Colin Cross wrote:
>> I'm trying to use the standard ledtrig-timer.c code to handle led
>> blinking for notifications on an Android device, and I'm hitting some
>> issues with setting permissions on the dynamically created delay_on
>> and delay_off attributes. For most sysfs files, we have userspace
>> uevent parser that watches for device add notifications and
>> chowns/chmods attributes. This doesn't work for delay_on and
>> delay_off, because they are created later, when "timer" is written to
>> the trigger attribute. There is no uevent when the new files are
>> created, and sysfs doesn't support inotify, so I don't see any way to
>> receive an event to set the permissions. This issue exists any time
>> that device_create_file is called after device_add.
>>
>> What is the appropriate way to get an event to set the permissions?
>> Add inotify support for sysfs file creation? Send a KOBJ_CHANGE
>> uevent in device_create_file?
>
> No.
>
>> Send a KOBJ_CHANGE uevent from the driver after calling
>> device_create_file?
>
> Yes.
>
>> Dynamically create a timer device under /sys/class/leds/<led> so a new
>> add uevent gets sent?
>
> Ick.
>
>> Promote blinking to be a core led feature instead of a trigger, so the
>> files are always present?
>
> That's the best thing, why not just do that?
It doesn't solve the general case. For example, any driver that is
loaded as a module and then calls device_create_file will suffer the
same problem. But since it solves the one I care about, I'll look
into it.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists