#include <ccid.h>
#include <ctype.h>
#include <errno.h>
#include "ccid-internal.h"
Go to the source code of this file.
Data Structures | |
struct | devid |
Defines | |
#define | DEVID_ALLOC_CHUNK (1<<5) |
#define | DEVID_ALLOC_MASK (DEVID_ALLOC_CHUNK - 1) |
Functions | |
static int | easy_explode (char *str, char split, char **toks, int max_toks) |
static int | strtou16 (const char *s, uint16_t *v) |
static int | devid_assure (struct devid **d, unsigned int cnt) |
static int | append_devid (struct devid **d, unsigned int *cnt, uint16_t idProduct, uint16_t idVendor, const char *str) |
static struct devid * | load_device_types (unsigned int *pcnt) |
static void | zap_device_types (struct devid *d, unsigned int num) |
static void | reload_device_types (void) |
static void | do_init (void) |
static int | check_interface (struct libusb_device *dev, int c, int i, int generic) |
static int | check_vendor_dev_list (uint16_t idVendor, uint16_t idProduct) |
int | _probe_descriptors (struct libusb_device *dev, int *cp, int *ip, int *ap) |
Probe a USB device for a CCID interface. | |
ccidev_t * | ccid_get_device_list (size_t *nmemb) |
Find first physical CCI device on the system. | |
void | ccid_free_device_list (ccidev_t *list) |
ccidev_t | ccid_device (uint8_t bus, uint8_t addr) |
uint8_t | ccid_device_bus (ccidev_t dev) |
uint8_t | ccid_device_addr (ccidev_t dev) |
Variables | |
static libusb_context * | ctx |
static struct devid * | devid |
static unsigned int | num_devid |
#define DEVID_ALLOC_CHUNK (1<<5) |
Definition at line 21 of file ccidev.c.
Referenced by devid_assure().
#define DEVID_ALLOC_MASK (DEVID_ALLOC_CHUNK - 1) |
Definition at line 22 of file ccidev.c.
Referenced by devid_assure().
int _probe_descriptors | ( | struct libusb_device * | dev, | |
int * | cp, | |||
int * | ip, | |||
int * | ap | |||
) |
Probe a USB device for a CCID interface.
dev | ccidev_t representing a physical device. | |
cp | Pointer to an integer to retrieve configuration number. | |
ip | Pointer to an integer to retrieve interface number. | |
ap | Pointer to an integer to retrieve alternate setting number. |
Definition at line 260 of file ccidev.c.
References check_interface(), and check_vendor_dev_list().
Referenced by cci_probe(), ccid_device(), and ccid_get_device_list().
static int append_devid | ( | struct devid ** | d, | |
unsigned int * | cnt, | |||
uint16_t | idProduct, | |||
uint16_t | idVendor, | |||
const char * | str | |||
) | [static] |
Definition at line 96 of file ccidev.c.
References devid_assure().
Referenced by load_device_types().
ccidev_t ccid_device | ( | uint8_t | bus, | |
uint8_t | addr | |||
) |
Definition at line 343 of file ccidev.c.
References _probe_descriptors(), ctx, and do_init().
Referenced by cp_dev_init().
uint8_t ccid_device_addr | ( | ccidev_t | dev | ) |
Definition at line 377 of file ccidev.c.
Referenced by cp_dev_addr().
uint8_t ccid_device_bus | ( | ccidev_t | dev | ) |
Definition at line 372 of file ccidev.c.
Referenced by cp_dev_bus().
void ccid_free_device_list | ( | ccidev_t * | list | ) |
Definition at line 333 of file ccidev.c.
Referenced by cp_devlist_dealloc(), and main().
static int check_interface | ( | struct libusb_device * | dev, | |
int | c, | |||
int | i, | |||
int | generic | |||
) | [static] |
Definition at line 200 of file ccidev.c.
Referenced by _probe_descriptors().
static int check_vendor_dev_list | ( | uint16_t | idVendor, | |
uint16_t | idProduct | |||
) | [static] |
Definition at line 237 of file ccidev.c.
References num_devid.
Referenced by _probe_descriptors().
static int devid_assure | ( | struct devid ** | d, | |
unsigned int | cnt | |||
) | [static] |
Definition at line 81 of file ccidev.c.
References DEVID_ALLOC_CHUNK, and DEVID_ALLOC_MASK.
Referenced by append_devid().
static void do_init | ( | void | ) | [static] |
Definition at line 193 of file ccidev.c.
References ctx, and reload_device_types().
Referenced by ccid_device(), and ccid_get_device_list().
static int easy_explode | ( | char * | str, | |
char | split, | |||
char ** | toks, | |||
int | max_toks | |||
) | [static] |
Definition at line 27 of file ccidev.c.
Referenced by load_device_types().
static struct devid* load_device_types | ( | unsigned int * | pcnt | ) | [static, read] |
Definition at line 116 of file ccidev.c.
References append_devid(), CCID_UTILS_DATADIR, easy_explode(), devid::idProduct, devid::idVendor, PACKAGE, and strtou16().
Referenced by reload_device_types().
static void reload_device_types | ( | void | ) | [static] |
Definition at line 179 of file ccidev.c.
References load_device_types(), num_devid, and zap_device_types().
Referenced by do_init().
static int strtou16 | ( | const char * | s, | |
uint16_t * | v | |||
) | [static] |
Definition at line 56 of file ccidev.c.
Referenced by load_device_types().
static void zap_device_types | ( | struct devid * | d, | |
unsigned int | num | |||
) | [static] |
Definition at line 171 of file ccidev.c.
References devid::name.
Referenced by reload_device_types().
libusb_context* ctx [static] |
Definition at line 13 of file ccidev.c.
Referenced by ccid_device(), ccid_get_device_list(), and do_init().
unsigned int num_devid [static] |
Definition at line 24 of file ccidev.c.
Referenced by check_vendor_dev_list(), and reload_device_types().