[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2024051618-creation-mutilator-c871@gregkh>
Date: Thu, 16 May 2024 20:32:46 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Thomas Weißschuh <linux@...ssschuh.net>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
linux-kernel@...r.kernel.org, Sebastian Reichel <sre@...nel.org>,
linux-pm@...r.kernel.org
Subject: Re: [PATCH RFC] kobject_uevent: notify uevent sysfs file on changes
On Thu, May 16, 2024 at 07:41:07PM +0200, Thomas Weißschuh wrote:
> On 2024-05-16 13:17:34+0000, Greg Kroah-Hartman wrote:
> > On Thu, May 16, 2024 at 12:27:58PM +0200, Thomas Weißschuh wrote:
> > > The sysfs file "uevent" that exists for each device
> > > contains the same information that is attached to uevents emitted via
> > > netlink (or the usermode helper).
> > > This is useful for userspace which interacts with sysfs directly,
> > > without using (lib)udev.
> > >
> > > However it is not possible to actually get notified when the data in
> > > the "uevent" file changes.
> >
> > What is wrong with listening to the uevent that is happening when the
> > file changes?
>
> It requires netlink or libudev which is not available or ergonimic for
> all userspace programs.
> Shellscripts, simple C applications, programing languages without
> access to netlink/libudev.
>
> I noticed this when using the "Waybar" application[0] and missing power
> supply event updates. Both me and the authors of Waybar expected sysfs
> notifications to work for uevent files.
"Waybar" is anything but a "simple C application", the dependancy chain
it has is quite huge, adding libudev should be very easy, and probably
already there. Oh look, it is there, upower already brings it in, so no
need to worry about adding another dependancy.
So I think maybe just using the library already in the program might be
simplest, even simpler than attempting to use inotify and friends (as
you don't have to figure out the actual file that you care about, gudev
has that information already for you, abstracted away properly.)
thanks,
greg k-h
Powered by blists - more mailing lists