src/ccidev.c File Reference

#include <ccid.h>
#include <ctype.h>
#include <errno.h>
#include "ccid-internal.h"
Include dependency graph for ccidev.c:

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 devidload_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_tccid_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 deviddevid
static unsigned int num_devid

Define Documentation

#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().


Function Documentation

int _probe_descriptors ( struct libusb_device *  dev,
int *  cp,
int *  ip,
int *  ap 
)

Probe a USB device for a CCID interface.

Parameters:
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.
Returns:
zero indicates failure.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t ccid_device_addr ( ccidev_t  dev  ) 

Definition at line 377 of file ccidev.c.

Referenced by cp_dev_addr().

Here is the caller graph for this function:

uint8_t ccid_device_bus ( ccidev_t  dev  ) 

Definition at line 372 of file ccidev.c.

Referenced by cp_dev_bus().

Here is the caller graph for this function:

void ccid_free_device_list ( ccidev_t list  ) 

Definition at line 333 of file ccidev.c.

Referenced by cp_devlist_dealloc(), and main().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

static int strtou16 ( const char *  s,
uint16_t *  v 
) [static]

Definition at line 56 of file ccidev.c.

Referenced by load_device_types().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:


Variable Documentation

libusb_context* ctx [static]

Definition at line 13 of file ccidev.c.

Referenced by ccid_device(), ccid_get_device_list(), and do_init().

struct devid* devid [static]

Definition at line 23 of file ccidev.c.

unsigned int num_devid [static]

Definition at line 24 of file ccidev.c.

Referenced by check_vendor_dev_list(), and reload_device_types().

Generated on Sun Jan 2 08:35:05 2011 for ccid-utils by  doxygen 1.6.3