mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-24 16:43:28 +02:00
scd: Log info about CCIDs with permission problems.
* scd/apdu.c (open_ccid_reader): Add arg r_cciderr. (apdu_open_reader): Print a note on EPERM of the USB device. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
9a8d7e41bb
commit
2af884c643
16
scd/apdu.c
16
scd/apdu.c
@ -1584,13 +1584,15 @@ ccid_pinpad_operation (int slot, int class, int ins, int p0, int p1,
|
|||||||
|
|
||||||
/* Open the reader and try to read an ATR. */
|
/* Open the reader and try to read an ATR. */
|
||||||
static int
|
static int
|
||||||
open_ccid_reader (struct dev_list *dl)
|
open_ccid_reader (struct dev_list *dl, int *r_cciderr)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int slot;
|
int slot;
|
||||||
int require_get_status;
|
int require_get_status;
|
||||||
reader_table_t slotp;
|
reader_table_t slotp;
|
||||||
|
|
||||||
|
*r_cciderr = 0;
|
||||||
|
|
||||||
slot = new_reader_slot ();
|
slot = new_reader_slot ();
|
||||||
if (slot == -1)
|
if (slot == -1)
|
||||||
return -1;
|
return -1;
|
||||||
@ -1610,6 +1612,7 @@ open_ccid_reader (struct dev_list *dl)
|
|||||||
{
|
{
|
||||||
slotp->used = 0;
|
slotp->used = 0;
|
||||||
unlock_slot (slot);
|
unlock_slot (slot);
|
||||||
|
*r_cciderr = err;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2110,9 +2113,11 @@ apdu_open_reader (struct dev_list *dl)
|
|||||||
#ifdef HAVE_LIBUSB
|
#ifdef HAVE_LIBUSB
|
||||||
if (!opt.disable_ccid)
|
if (!opt.disable_ccid)
|
||||||
{ /* CCID readers. */
|
{ /* CCID readers. */
|
||||||
|
int cciderr;
|
||||||
|
|
||||||
if (readerno > 0)
|
if (readerno > 0)
|
||||||
{ /* Use single, the specific reader. */
|
{ /* Use single, the specific reader. */
|
||||||
slot = open_ccid_reader (dl);
|
slot = open_ccid_reader (dl, &cciderr);
|
||||||
/* And stick the reader and no scan. */
|
/* And stick the reader and no scan. */
|
||||||
dl->idx = dl->idx_max;
|
dl->idx = dl->idx_max;
|
||||||
return slot;
|
return slot;
|
||||||
@ -2137,7 +2142,7 @@ apdu_open_reader (struct dev_list *dl)
|
|||||||
if (DBG_READER)
|
if (DBG_READER)
|
||||||
log_debug ("apdu_open_reader: new device=%x\n", bai);
|
log_debug ("apdu_open_reader: new device=%x\n", bai);
|
||||||
|
|
||||||
slot = open_ccid_reader (dl);
|
slot = open_ccid_reader (dl, &cciderr);
|
||||||
|
|
||||||
dl->idx++;
|
dl->idx++;
|
||||||
if (slot >= 0)
|
if (slot >= 0)
|
||||||
@ -2146,6 +2151,11 @@ apdu_open_reader (struct dev_list *dl)
|
|||||||
{
|
{
|
||||||
/* Skip this reader. */
|
/* Skip this reader. */
|
||||||
log_error ("ccid open error: skip\n");
|
log_error ("ccid open error: skip\n");
|
||||||
|
if (cciderr == CCID_DRIVER_ERR_USB_ACCESS)
|
||||||
|
log_info ("check permission of USB device at"
|
||||||
|
" Bus %03d Device %03d\n",
|
||||||
|
((bai >> 16) & 0xff),
|
||||||
|
((bai >> 8) & 0xff));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user