mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
scd: Clean up unused shutdown method.
* scd/apdu.c (shutdown_ccid_reader, apdu_shutdown_reader): Remove. (reset_ccid_reader): Don't set shutdown_reader. * scd/ccid-driver.c (ccid_shutdown_reader): Remove. -- Backport of master commit: d1ae7103352fbda2a05f098379cd3043a0ab5566 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
519c01a0fd
commit
5acce7060c
29
scd/apdu.c
29
scd/apdu.c
@ -98,7 +98,6 @@ struct reader_table_s {
|
||||
int (*connect_card)(int);
|
||||
int (*disconnect_card)(int);
|
||||
int (*close_reader)(int);
|
||||
int (*shutdown_reader)(int);
|
||||
int (*reset_reader)(int);
|
||||
int (*get_status_reader)(int, unsigned int *);
|
||||
int (*send_apdu_reader)(int,unsigned char *,size_t,
|
||||
@ -432,7 +431,6 @@ new_reader_slot (void)
|
||||
reader_table[reader].connect_card = NULL;
|
||||
reader_table[reader].disconnect_card = NULL;
|
||||
reader_table[reader].close_reader = NULL;
|
||||
reader_table[reader].shutdown_reader = NULL;
|
||||
reader_table[reader].reset_reader = NULL;
|
||||
reader_table[reader].get_status_reader = NULL;
|
||||
reader_table[reader].send_apdu_reader = NULL;
|
||||
@ -2436,14 +2434,6 @@ close_ccid_reader (int slot)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
shutdown_ccid_reader (int slot)
|
||||
{
|
||||
ccid_shutdown_reader (reader_table[slot].ccid.handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
reset_ccid_reader (int slot)
|
||||
{
|
||||
@ -2609,7 +2599,6 @@ open_ccid_reader (const char *portstr)
|
||||
}
|
||||
|
||||
reader_table[slot].close_reader = close_ccid_reader;
|
||||
reader_table[slot].shutdown_reader = shutdown_ccid_reader;
|
||||
reader_table[slot].reset_reader = reset_ccid_reader;
|
||||
reader_table[slot].get_status_reader = get_status_ccid;
|
||||
reader_table[slot].send_apdu_reader = send_apdu_ccid;
|
||||
@ -3178,24 +3167,6 @@ apdu_prepare_exit (void)
|
||||
}
|
||||
|
||||
|
||||
/* Shutdown a reader; that is basically the same as a close but keeps
|
||||
the handle ready for later use. A apdu_reset_reader or apdu_connect
|
||||
should be used to get it active again. */
|
||||
int
|
||||
apdu_shutdown_reader (int slot)
|
||||
{
|
||||
int sw;
|
||||
|
||||
if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used )
|
||||
return SW_HOST_NO_DRIVER;
|
||||
sw = apdu_disconnect (slot);
|
||||
if (sw)
|
||||
return sw;
|
||||
if (reader_table[slot].shutdown_reader)
|
||||
return reader_table[slot].shutdown_reader (slot);
|
||||
return SW_HOST_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* Enumerate all readers and return information on whether this reader
|
||||
is in use. The caller should start with SLOT set to 0 and
|
||||
increment it with each call until an error is returned. */
|
||||
|
@ -92,7 +92,6 @@ int apdu_open_remote_reader (const char *portstr,
|
||||
void *writefnc_value,
|
||||
void (*closefnc) (void *opaque),
|
||||
void *closefnc_value);
|
||||
int apdu_shutdown_reader (int slot);
|
||||
int apdu_close_reader (int slot);
|
||||
void apdu_prepare_exit (void);
|
||||
int apdu_enum_reader (int slot, int *used);
|
||||
|
@ -1744,79 +1744,6 @@ do_close_reader (ccid_driver_t handle)
|
||||
}
|
||||
|
||||
|
||||
/* Reset a reader on HANDLE. This is useful in case a reader has been
|
||||
plugged of and inserted at a different port. By resetting the
|
||||
handle, the same reader will be get used. Note, that on error the
|
||||
handle won't get released.
|
||||
|
||||
This does not return an ATR, so ccid_get_atr should be called right
|
||||
after this one.
|
||||
*/
|
||||
int
|
||||
ccid_shutdown_reader (ccid_driver_t handle)
|
||||
{
|
||||
int rc = 0;
|
||||
struct usb_device *dev = NULL;
|
||||
usb_dev_handle *idev = NULL;
|
||||
unsigned char *ifcdesc_extra = NULL;
|
||||
size_t ifcdesc_extra_len;
|
||||
int ifc_no, ep_bulk_out, ep_bulk_in, ep_intr;
|
||||
|
||||
if (!handle || !handle->rid)
|
||||
return CCID_DRIVER_ERR_INV_VALUE;
|
||||
|
||||
do_close_reader (handle);
|
||||
|
||||
if (scan_or_find_devices (-1, handle->rid, NULL, &dev,
|
||||
&ifcdesc_extra, &ifcdesc_extra_len,
|
||||
&ifc_no, &ep_bulk_out, &ep_bulk_in, &ep_intr,
|
||||
&idev, NULL) || !idev)
|
||||
{
|
||||
DEBUGOUT_1 ("no CCID reader with ID %s\n", handle->rid);
|
||||
return CCID_DRIVER_ERR_NO_READER;
|
||||
}
|
||||
|
||||
if (idev)
|
||||
{
|
||||
handle->idev = idev;
|
||||
handle->ifc_no = ifc_no;
|
||||
handle->ep_bulk_out = ep_bulk_out;
|
||||
handle->ep_bulk_in = ep_bulk_in;
|
||||
handle->ep_intr = ep_intr;
|
||||
|
||||
if (parse_ccid_descriptor (handle, ifcdesc_extra, ifcdesc_extra_len))
|
||||
{
|
||||
DEBUGOUT ("device not supported\n");
|
||||
rc = CCID_DRIVER_ERR_NO_READER;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
rc = usb_claim_interface (idev, ifc_no);
|
||||
if (rc)
|
||||
{
|
||||
DEBUGOUT_1 ("usb_claim_interface failed: %d\n", rc);
|
||||
rc = CCID_DRIVER_ERR_CARD_IO_ERROR;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
|
||||
leave:
|
||||
free (ifcdesc_extra);
|
||||
if (rc)
|
||||
{
|
||||
if (handle->idev)
|
||||
usb_close (handle->idev);
|
||||
handle->idev = NULL;
|
||||
if (handle->dev_fd != -1)
|
||||
close (handle->dev_fd);
|
||||
handle->dev_fd = -1;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ccid_set_progress_cb (ccid_driver_t handle,
|
||||
void (*cb)(void *, const char *, int, int, int),
|
||||
|
Loading…
x
Reference in New Issue
Block a user