[systemd-devel] Needs help for on charging activation

Kyungmin Park kmpark at infradead.org
Fri Mar 13 06:53:27 PDT 2015

Hi Lennart,

Any comments?

We hope to assign our work with systemd one.

Thank you,
Kyungmin Park

On Monday, March 9, 2015, WaLyong Cho <walyong.cho at samsung.com> wrote:

> Hi,
> I want to find best solution on our case. Our product is mobile device.
> But I don't think that is only problem of mobile device. That also can
> be problem of laptop. So, please comment to me.
> We have some of services are always running after system is started up
> as default. They don't need to be running always. They are just needed
> only charger is plugged in.
> So I thought lets only active them when only charger is plugged in.
> I thought two methods.
> method 1:
> Charger also can be detected by udev. So udev hardware activation can be
> used.
> I wrote below udev rules.
> TAG+="systemd", ENV{SYSTEMD_WANTS}+="foo.service"
> It looked working well. foo.service is only activated when charger was
> plugged in.
> But I have some of problems with hardware activation.
> I want to be stopped foo.service when the charger is plugged out. As I
> know, this is impossible with udev hardware activation.
> To do this, foo.service have to determine the charger state itself and
> if the charger is plugged out, it have to stop itself.
> And it is working only at the first time.
> After foo.service was activated, I stopped foo.service by "systemctl
> stop foo.service". And plug out and plug in the charger again. Then
> foo.service was not activated. (Is it normal? I did not try to find the
> reason. If you say it's a problem, then I will try to find.)
> method 2:
> We have another device daemon. Let's call that as deviced and its
> service name is deviced.service. deviced know about plug in/out of the
> charger.
> So, I made a new charging.target. foo.service have Wants= dependency for
> charging.target. (Installed on charging.target.wants.) And I added
> "BindsTo=charging.target" to foo.service.
> Then foo.service is activated well when the charging.target is entered
> to active state. And also deactivated when charging.target was deactivated.
> In this method, there are limitations what some of other daemon is
> needed and new charging.target is needed.
> Is there any more good way for this?
> I want to find best appropriate way.
> Thank you in advance for comment.
> WaLyong
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org <javascript:;>
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150313/e5bc6b1f/attachment.html>

More information about the systemd-devel mailing list