2011/10/17 Kalev Lember <[email protected]>:
> On 10/16/2011 11:18 AM, Ludovic Rousseau wrote:
>> Hello Kalev,
>>
>> Some more questions :-)
>>
>> 2011/6/25 Kalev Lember <[email protected]>:
>>> diff --git a/PCSC/etc/pcscd.service.in b/PCSC/etc/pcscd.service.in
>>> new file mode 100644
>>> index 0000000..4800d32
>>> --- /dev/null
>>> +++ b/PCSC/etc/pcscd.service.in
>>> @@ -0,0 +1,13 @@
>>> +[Unit]
>>> +Description=PC/SC Smart Card Daemon
>>> +Requires=pcscd.socket
>>> +After=syslog.target
>
> (According to Lennart, After=syslog.target is no longer necessary with
> the version of systemd in Fedora 16, so we could probably drop this line.)

Do you know in which systemd version this has changed?
Debian testing/wheezy has systemd 29 and unstable/sid has 37.

>>> +[Service]
>>> +ExecStart=@sbindir_exp@/pcscd -f
>>> +ExecReload=@sbindir_exp@/pcscd -H
>>> +StandardOutput=syslog
>
> (... and the same as above about StandardOutput=syslog: stdout and
> stderr should now be connected to syslog by default.)

OK. But same question :-)

>>> +
>>> +[Install]
>>> +WantedBy=multi-user.target
>>> +Also=pcscd.socket
>>
>> Why do you have "WantedBy=multi-user.target"?
>> The idea is to have pcscd started on demand using the socket
>> activation mechanism. I do not want to have pcscd started at boot, but
>> only on demand.
>> So I propose to remove the line.
>
> The [Install] section is used when someone runs 'systemctl enable' /
> 'systemctl disable' on the pcscd.service file. When a user runs the
> command, the WantedBy=multi-user.target line adds the pcscd.service
> dependency to the multi-user.target, effectively marking pcscd to always
> start up on system boot. I can imagine that some people would want to do
> that, but I'm personally fine with killing that use case.

OK. I will remove it.
The only reason I find to start pcscd at boot is because pcscd is slow
to start. This can happen if you have _a lot_ of USB readers or slow
to setup readers like serial ones.

> A related question -- why do you ship pcscd sysv init script in the
> Debian package, instead of just relying on the on-demand startup?

With the (old) on-demand startup [2] pcscd is started by libpcsclite.
In this case pcscd is not run as root and can't create the
/var/run//pcscd/ directory if needed. The Debian init script does just
create the directory, set the correct access rights and exit.

> I think in the long run we'll instead want to have
> 'WantedBy=smartcard.target' and configure it for hardware activation.
> But I haven't yet looked into how it works so I don't know the details.

Is the idea to start pcscd when a smart card reader is connected?
Why do you want that?

>> I am no sure the line "Also=pcscd.socket" is needed. I removed it
>> without any problem.
>
> Like the rest of the [Install] section in pcscd.service, this is only
> used when someone runs 'systemctl enable/disable pcscd.service'. The
> Also=pcscd.socket line also enables pcscd.socket when pcscd.service is
> enabled. That way, people can run 'systemctl enable pcscd.service'
> instead of 'systemctl enable pcscd.socket' and things would
> automagically still work correctly.
>
> I'd certainly vote for keeping this one.

OK. I will see what are the side effects of keeping this line.

>> I played with systemd and what I was missing is that I need to enable
>> and start the pcscd.socket using:
>> $ sudo systemctl enable pcscd.socket
>> $ sudo systemctl start pcscd.socket
>>
>>
>> I also added the --auto-exit option to pcscd so that the daemon will
>> exit when no more needed.
>> The daemon is started when needed using the systemd socket activation
>> method and will exit automatically when not needed.
>
> Not sure ... If you say you've tested it and systemd plays nice when the
> daemon exits with exit code 0, I guess this could work. Might want to
> bring this up on the systemd mailing list.

I changed pcscd to return 0 for this use case in revision 6044 [1]. It
worked well. But I need to make more stress tests.

Thanks

[1] 
http://lists.alioth.debian.org/pipermail/pcsclite-cvs-commit/2011-October/005595.html
[2] http://ludovicrousseau.blogspot.com/2010/09/pcscd-auto-start.html

-- 
 Dr. Ludovic Rousseau

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to