mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
scd: Only submit apdu_get_status when needed.
* scd/apdu.c (apdu_dev_list_finish): Return Boolean value if all device support INTERRUPT transfer. * scd/ccid-driver.c (ccid_dev_scan_finish): Likewise. * scd/app.c (app_new_register): Fix initial value of card_status. (select_application): Call update_fdset_for_usb. (scd_update_reader_status_file): Ditto. * scd/scdaemon.c (update_fdset_for_usb, need_tick): New. (handle_connections): Call handle_tick when select returns. Let select watch USB file descriptors, too. Call libusb_handle_events_timeout_completed for INTERRUPT transfer. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
9b06633c81
commit
881dcdfd84
7 changed files with 145 additions and 42 deletions
|
@ -192,6 +192,7 @@ app_new_register (int slot, ctrl_t ctrl, const char *name)
|
|||
}
|
||||
|
||||
app->slot = slot;
|
||||
app->card_status = (unsigned int)-1;
|
||||
|
||||
if (npth_mutex_init (&app->lock, NULL))
|
||||
{
|
||||
|
@ -329,6 +330,7 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
|
|||
if (scan || !app_top)
|
||||
{
|
||||
struct dev_list *l;
|
||||
int all_have_intr_endp;
|
||||
|
||||
err = apdu_dev_list_start (opt.reader_port, &l);
|
||||
if (err)
|
||||
|
@ -368,7 +370,8 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
|
|||
}
|
||||
}
|
||||
|
||||
apdu_dev_list_finish (l);
|
||||
all_have_intr_endp = apdu_dev_list_finish (l);
|
||||
update_fdset_for_usb (1, all_have_intr_endp);
|
||||
}
|
||||
|
||||
npth_mutex_lock (&app_list_lock);
|
||||
|
@ -1050,6 +1053,7 @@ scd_update_reader_status_file (void)
|
|||
log_debug ("Removal of a card: %d\n", a->slot);
|
||||
apdu_close_reader (a->slot);
|
||||
deallocate_app (a);
|
||||
update_fdset_for_usb (0, 0);
|
||||
}
|
||||
else
|
||||
a->card_status = status;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue