2011/9/3 Kalev Lember <[email protected]>: > On 09/02/2011 11:46 AM, Ludovic Rousseau wrote: >> Hello Kalev, > > Hello Ludovic, > > Thanks for your comments!
You're welcome. But you did the job in the first place. >> I have some questions: >> - who is supposed to create the /var/run/pcscd/pcscd.comm socket? I >> guess it is systemd. > > Yes. Systemd creates the socket when pcscd.socket unit is started and > starts listening on it. When a request comes in, systemd then > automatically starts the pcscd.service unit, whichs in turn spawns > pcscd. The socket's file descriptor is passed on to pcscd and pcscd > deals with the data waiting in the buffer. On my Debian system systemd does not create the socket :-( Could it be because the socket name is /var/run/pcscd/pcscd.comm but the directory /var/run/pcscd does not exist? I have to run "systemctl start pcscd.service" manualy. Note that if the socket if found then pcscd will consider another pcscd is already running and will try to open the /var/run/pcscd/pcscd.pid file to get the pid of the other pcscd process. If pcscd is started by systemd the socket will be present but the pcscd.pid will not be there and pcscd will complain and exit. I my logs I have: Sep 4 00:19:48 debian pcscd[19438]: 00000000 utils.c:53:GetDaemonPid() Can't open /var/run/pcscd/pcscd.pid: No such file or directory Sep 4 00:20:09 debian pcscd[19460]: 00000000 utils.c:53:GetDaemonPid() Can't open /var/run/pcscd/pcscd.pid: No such file or directory Sep 4 00:20:09 debian pcscd[19463]: 00000000 utils.c:53:GetDaemonPid() Can't open /var/run/pcscd/pcscd.pid: No such file or directory Sep 4 00:20:09 debian pcscd[19466]: 00000000 utils.c:53:GetDaemonPid() Can't open /var/run/pcscd/pcscd.pid: No such file or directory Sep 4 00:20:09 debian pcscd[19469]: 00000000 utils.c:53:GetDaemonPid() Can't open /var/run/pcscd/pcscd.pid: No such file or directory Sep 4 00:20:09 debian pcscd[19472]: 00000000 utils.c:53:GetDaemonPid() Can't open /var/run/pcscd/pcscd.pid: No such file or directory Sep 4 00:20:09 debian pcscd[19475]: 00000000 utils.c:53:GetDaemonPid() Can't open /var/run/pcscd/pcscd.pid: No such file or directory Sep 4 00:20:09 debian systemd[1]: pcscd.service start request repeated too quickly, refusing to start. Sep 4 00:20:09 debian systemd[1]: pcscd.service start request repeated too quickly, refusing to start. I don't know how it can work on Fedora. Have you made other changes you have not sent me? > There's a very nice description of socket activation at > http://0pointer.de/blog/projects/socket-activation.html I still have a lot to read about systemd. >> - how to tell systemd to recreate the socket if it has been removed? > > By (re)starting the pcscd.socket unit file, but ... > > ... the idea behind socket activation is that systemd creates the socket > once and apps can then rely on the socket being there and never going > away. Even if the pcscd daemon crashes, the socket file is still there > and systemd will transparently spawn a new pcscd process. > > pcscd itself should certainly never remove the socket. I think you already fixed that in the clean_temp_files() function in pcscdaemon.c >> - do you think it is a good idea to use User=, Group= to start pcscd >> as nobody and group pcscd? The CCID driver already provides a udev >> rule file to set access rights for group pcscd. See also >> http://ludovicrousseau.blogspot.com/2010/09/pcscd-auto-start.html > > Yes, I think dropping privileges would be an excellent idea. I would, > however, prefer getting the current functionality in and adding this as > an incremental change later. After all, the patches I sent are tested in > Fedora and should be a reasonable base for further improvements. What do > you think of that? I committed your changes in subversion revisions 5929, 5931 and 5933. You can get a snapshot of pcsc-lite at [1]. Please tell me if you are OK with the code. >> - is it possible to use the --auto-exit feature of pcscd with systemd? >> The idea is that the daemon exits itself when no client is using it. >> pcscd remove the socket on exit. Maybe it is a problem for systemd, >> see first question. > > Socket removal is certainly a problem. Not sure about --auto-exit > otherwise; it might actually work. Could it be something that we can > also add as an incremental update, or would you like me to figure out > whether this can work right away? Exiting pcscd will allow the USB selective suspend to work. See [2]. So it is really a requested feature. And I think systemd can do that for us. I have a lot of systemd reading, debug and testing ahead. Thanks [1] http://ludovic.rousseau.free.fr/softwares/pcsc-lite/ [2] http://ludovicrousseau.blogspot.com/2011/04/libccid-and-usb-selective-suspend.html -- Dr. Ludovic Rousseau _______________________________________________ Muscle mailing list [email protected] http://lists.drizzle.com/mailman/listinfo/muscle
