aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-03-19 00:53:17 +0000
committerNIIBE Yutaka <[email protected]>2020-04-02 05:11:52 +0000
commit00995f5f3504cc2700492e8d286789411b497fc7 (patch)
treedd5df608fb1462b6a7df0d13ff71511e2e7ad1d4
parentwatch: Add --scan option. (diff)
downloadgnupg-00995f5f3504cc2700492e8d286789411b497fc7.tar.gz
gnupg-00995f5f3504cc2700492e8d286789411b497fc7.zip
watch: show information.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--scd/app.c30
-rw-r--r--scd/command.c2
-rw-r--r--scd/scdaemon.h1
3 files changed, 31 insertions, 2 deletions
diff --git a/scd/app.c b/scd/app.c
index aac9d304d..44644fd71 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -283,6 +283,34 @@ app_dump_state (void)
}
+void
+app_show_list (ctrl_t ctrl)
+{
+ card_t c;
+ app_t a;
+
+ send_status_direct (ctrl, "LIST_DEVICE", "show status of all devices");
+
+ npth_mutex_lock (&card_list_lock);
+ for (c = card_top; c; c = c->next)
+ {
+ char card_info[50];
+
+ snprintf (card_info, sizeof card_info, "card=%p slot=%d type=%s",
+ c, c->slot, strcardtype (c->cardtype));
+
+ for (a = c->app; a; a = a->next)
+ {
+ char app_info[50];
+
+ snprintf (app_info, sizeof app_info, "app=%p type=%s",
+ a, strapptype (a->apptype));
+ send_status_direct (ctrl, card_info, app_info);
+ }
+ }
+ npth_mutex_unlock (&card_list_lock);
+}
+
/* Check whether the application NAME is allowed. This does not mean
we have support for it though. */
static int
@@ -2026,7 +2054,7 @@ initialize_module_command (void)
{
err = gpg_error_from_syserror ();
log_error ("npth_cond_init failed: %s\n", gpg_strerror (err));
- return;
+ return err;
}
return apdu_init ();
diff --git a/scd/command.c b/scd/command.c
index 4903f1f04..aa34c2825 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -2167,7 +2167,7 @@ cmd_list_device (assuan_context_t ctx, char *line)
if (has_option (line, "--scan"))
scan = 1;
- assuan_write_status (ctx, "LIST_DEVICE", "... show status of all devices");
+ app_show_list (ctrl);
/* Clear the remove flag so that the open_card is able to reread it. */
if (ctrl->server_local->card_removed)
diff --git a/scd/scdaemon.h b/scd/scdaemon.h
index 19f7e9d3f..02ccf4447 100644
--- a/scd/scdaemon.h
+++ b/scd/scdaemon.h
@@ -154,5 +154,6 @@ int get_active_connection_count (void);
/*-- app.c --*/
int scd_update_reader_status_file (void);
int app_wait (void);
+void app_show_list (ctrl_t ctrl);
#endif /*SCDAEMON_H*/