On Fri, 28.02.14 02:21, Timothée Ravier (sios...@gmail.com) wrote: > > On 26/02/2014 02:38, Lennart Poettering wrote: > > On Wed, 26.02.14 02:01, Jason A. Donenfeld (ja...@zx2c4.com) wrote: > >> Upstream KDE patch is here: > >> https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/7584a63924620bac3bd87277c11cdb8cdb5018b1/diff/powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp?format=diff > > > > Wow. Just wow. I am feeling tempted to just randomly change the version > > string exposed on the bus now, until they give that up. Whate else can I > > do than actually document that the string isn't stable? > > > It is totally non-sensical to check for software versions the way KDE > > does it. We supply them with a call to check whether a certain operation > > is available (CanSuspend(), CanHibernate(), ...). They should just call > > that. It will tell them precisely whether the operation is not > > implemented in the code, or whether it is available on the hardware, and > > so on. But no, they decided to involve version checks... > > It looks like they check both systemd version and CanSuspend(), > CanHibernate() results: > https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/master/entry/powerdevil/daemon/backends/upower/powerdevilupowerbackend.cpp#L229 > > Could it be for compatibility with older systemd releases?
They should just invoke the methods. If they get org.freedesktop.DBus.Error.UnknownMethod, org.freedesktop.DBus.Error.UnknownObject or org.freedesktop.DBus.Error.UnknownInterface back they should assume that logind is too old and doesn't support the call. (Actually, to make this really robust, they should just treat any error like that). Check for features by trying to make use of them. Don't check for version numbers. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel