From 48e824b6ea69d21ccbc50aac125d8b442af66727 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 29 Oct 2021 10:48:01 +0900 Subject: scd: Modify DEVINFO behavior to support looping forever. * scd/app.c (struct mrsw_lock): Add notify_cond member. (notify_cond): Remove. (card_list_r_lock, card_list_r_unlock): Rename. (card_list_w_lock, card_list_w_unlock): Rename. (card_list_signal, card_list_wait): New, fixing thinko about notify/wakeup with MRSW lock. (app_send_devinfo): Support looping. (select_application): Notify app_send_devinfo thread for newly detected device. (initialize_module_command): Initialize notify_cond member. (app_wait): Remove. * scd/command.c (cmd_devinfo): Use new API of app_send_devinfo. * scd/scdaemon.h (app_wait): Remove. -- GnuPG-bug-id: 5359 Signed-off-by: NIIBE Yutaka --- scd/command.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'scd/command.c') diff --git a/scd/command.c b/scd/command.c index 6ffc13626..2128298c6 100644 --- a/scd/command.c +++ b/scd/command.c @@ -2279,7 +2279,7 @@ cmd_devinfo (assuan_context_t ctx, char *line) } /* Firstly, send information of available devices. */ - err = app_send_devinfo (ctrl); + err = app_send_devinfo (ctrl, 0); /* If not watching, that's all. */ if (!watch) @@ -2311,16 +2311,10 @@ cmd_devinfo (assuan_context_t ctx, char *line) } /* Then, keep watching the status change. */ - while (!err) - { - app_wait (); - - /* Send information of available devices. */ - err = app_send_devinfo (ctrl); - } + err = app_send_devinfo (ctrl, 1); ctrl->server_local->watching_status = 0; - return 0; + return err; } /* Return true if the command CMD implements the option OPT. */ -- cgit v1.2.3