astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60
This commit is contained in:
parent
26569c2202
commit
a2cd236441
45 changed files with 1096 additions and 1082 deletions
|
@ -6,13 +6,13 @@
|
|||
#define warnx(...) do { \
|
||||
fprintf (stderr, __VA_ARGS__); \
|
||||
fprintf (stderr, "\n"); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define errx(code, ...) do { \
|
||||
fprintf (stderr, __VA_ARGS__); \
|
||||
fprintf (stderr, "\n"); \
|
||||
exit (code); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define err errx
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ main (int argc, const char *argv[])
|
|||
uint8_t abtRx[MAX_FRAME_LEN];
|
||||
int szRx;
|
||||
uint8_t abtTx[] = "Hello Mars!";
|
||||
#define MAX_DEVICE_COUNT 2
|
||||
#define MAX_DEVICE_COUNT 2
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
size_t szDeviceFound = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
// Little hack to allow using nfc-dep-initiator & nfc-dep-target from
|
||||
|
|
|
@ -32,29 +32,29 @@
|
|||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
struct nfc_emulator;
|
||||
struct nfc_emulation_state_machine;
|
||||
struct nfc_emulator;
|
||||
struct nfc_emulation_state_machine;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @struct nfc_emulator
|
||||
* @brief NFC emulator structure
|
||||
*/
|
||||
struct nfc_emulator {
|
||||
struct nfc_emulator {
|
||||
nfc_target *target;
|
||||
struct nfc_emulation_state_machine *state_machine;
|
||||
void *user_data;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* @struct nfc_emulation_state_machine
|
||||
* @brief NFC emulation state machine structure
|
||||
*/
|
||||
struct nfc_emulation_state_machine {
|
||||
struct nfc_emulation_state_machine {
|
||||
int (*io)(struct nfc_emulator *emulator, const uint8_t *data_in, const size_t data_in_len, uint8_t *data_out, const size_t data_out_len);
|
||||
void *data;
|
||||
};
|
||||
};
|
||||
|
||||
NFC_EXPORT int nfc_emulate_target (nfc_device* pnd, struct nfc_emulator *emulator);
|
||||
NFC_EXPORT int nfc_emulate_target (nfc_device* pnd, struct nfc_emulator *emulator);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -48,20 +48,20 @@ typedef char nfc_connstring[1024];
|
|||
* Properties
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
/**
|
||||
* Default command processing timeout
|
||||
* Property value's (duration) unit is ms and 0 means no timeout (infinite).
|
||||
* Default value is set by driver layer
|
||||
*/
|
||||
NP_TIMEOUT_COMMAND,
|
||||
/**
|
||||
/**
|
||||
* Timeout between ATR_REQ and ATR_RES
|
||||
* When the device is in initiator mode, a target is considered as mute if no
|
||||
* valid ATR_RES is received within this timeout value.
|
||||
* Default value for this property is 103 ms on PN53x based devices.
|
||||
*/
|
||||
NP_TIMEOUT_ATR,
|
||||
/**
|
||||
/**
|
||||
* Timeout value to give up reception from the target in case of no answer.
|
||||
* Default value for this property is 52 ms).
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@ typedef enum {
|
|||
* this is useful are the ATQA and UID+BCC that are transmitted without CRC
|
||||
* bytes during the anti-collision phase of the ISO14443-A protocol. */
|
||||
NP_HANDLE_CRC,
|
||||
/** Parity bits in the network layer of ISO14443-A are by default generated and
|
||||
/** Parity bits in the network layer of ISO14443-A are by default generated and
|
||||
* validated in the PN53X chip. This is a very convenient feature. On certain
|
||||
* times though it is useful to get full control of the transmitted data. The
|
||||
* proprietary MIFARE Classic protocol uses for example custom (encrypted)
|
||||
|
@ -82,31 +82,31 @@ typedef enum {
|
|||
* compatible, including the arbitrary parity bits. When this option is
|
||||
* disabled, the functions to communicating bits should be used. */
|
||||
NP_HANDLE_PARITY,
|
||||
/** This option can be used to enable or disable the electronic field of the
|
||||
/** This option can be used to enable or disable the electronic field of the
|
||||
* NFC device. */
|
||||
NP_ACTIVATE_FIELD,
|
||||
/** The internal CRYPTO1 co-processor can be used to transmit messages
|
||||
/** The internal CRYPTO1 co-processor can be used to transmit messages
|
||||
* encrypted. This option is automatically activated after a successful MIFARE
|
||||
* Classic authentication. */
|
||||
NP_ACTIVATE_CRYPTO1,
|
||||
/** The default configuration defines that the PN53X chip will try indefinitely
|
||||
/** The default configuration defines that the PN53X chip will try indefinitely
|
||||
* to invite a tag in the field to respond. This could be desired when it is
|
||||
* certain a tag will enter the field. On the other hand, when this is
|
||||
* uncertain, it will block the application. This option could best be compared
|
||||
* to the (NON)BLOCKING option used by (socket)network programming. */
|
||||
NP_INFINITE_SELECT,
|
||||
/** If this option is enabled, frames that carry less than 4 bits are allowed.
|
||||
/** If this option is enabled, frames that carry less than 4 bits are allowed.
|
||||
* According to the standards these frames should normally be handles as
|
||||
* invalid frames. */
|
||||
NP_ACCEPT_INVALID_FRAMES,
|
||||
/** If the NFC device should only listen to frames, it could be useful to let
|
||||
/** If the NFC device should only listen to frames, it could be useful to let
|
||||
* it gather multiple frames in a sequence. They will be stored in the internal
|
||||
* FIFO of the PN53X chip. This could be retrieved by using the receive data
|
||||
* functions. Note that if the chip runs out of bytes (FIFO = 64 bytes long),
|
||||
* it will overwrite the first received frames, so quick retrieving of the
|
||||
* received data is desirable. */
|
||||
NP_ACCEPT_MULTIPLE_FRAMES,
|
||||
/** This option can be used to enable or disable the auto-switching mode to
|
||||
/** This option can be used to enable or disable the auto-switching mode to
|
||||
* ISO14443-4 is device is compliant.
|
||||
* In initiator mode, it means that NFC chip will send RATS automatically when
|
||||
* select and it will automatically poll for ISO14443-4 card when ISO14443A is
|
||||
|
@ -114,13 +114,13 @@ typedef enum {
|
|||
* In target mode, with a NFC chip compliant (ie. PN532), the chip will
|
||||
* emulate a 14443-4 PICC using hardware capability */
|
||||
NP_AUTO_ISO14443_4,
|
||||
/** Use automatic frames encapsulation and chaining. */
|
||||
/** Use automatic frames encapsulation and chaining. */
|
||||
NP_EASY_FRAMING,
|
||||
/** Force the chip to switch in ISO14443-A */
|
||||
/** Force the chip to switch in ISO14443-A */
|
||||
NP_FORCE_ISO14443_A,
|
||||
/** Force the chip to switch in ISO14443-B */
|
||||
/** Force the chip to switch in ISO14443-B */
|
||||
NP_FORCE_ISO14443_B,
|
||||
/** Force the chip to run at 106 kbps */
|
||||
/** Force the chip to run at 106 kbps */
|
||||
NP_FORCE_SPEED_106,
|
||||
} nfc_property;
|
||||
|
||||
|
@ -142,22 +142,22 @@ typedef enum {
|
|||
* @brief NFC target information in D.E.P. (Data Exchange Protocol) see ISO/IEC 18092 (NFCIP-1)
|
||||
*/
|
||||
typedef struct {
|
||||
/** NFCID3 */
|
||||
/** NFCID3 */
|
||||
uint8_t abtNFCID3[10];
|
||||
/** DID */
|
||||
/** DID */
|
||||
uint8_t btDID;
|
||||
/** Supported send-bit rate */
|
||||
/** Supported send-bit rate */
|
||||
uint8_t btBS;
|
||||
/** Supported receive-bit rate */
|
||||
/** Supported receive-bit rate */
|
||||
uint8_t btBR;
|
||||
/** Timeout value */
|
||||
/** Timeout value */
|
||||
uint8_t btTO;
|
||||
/** PP Parameters */
|
||||
/** PP Parameters */
|
||||
uint8_t btPP;
|
||||
/** General Bytes */
|
||||
/** General Bytes */
|
||||
uint8_t abtGB[48];
|
||||
size_t szGB;
|
||||
/** DEP mode */
|
||||
/** DEP mode */
|
||||
nfc_dep_mode ndm;
|
||||
} nfc_dep_info;
|
||||
|
||||
|
@ -191,13 +191,13 @@ typedef struct {
|
|||
* @brief NFC ISO14443B tag information
|
||||
*/
|
||||
typedef struct {
|
||||
/** abtPupi store PUPI contained in ATQB (Answer To reQuest of type B) (see ISO14443-3) */
|
||||
/** abtPupi store PUPI contained in ATQB (Answer To reQuest of type B) (see ISO14443-3) */
|
||||
uint8_t abtPupi[4];
|
||||
/** abtApplicationData store Application Data contained in ATQB (see ISO14443-3) */
|
||||
/** abtApplicationData store Application Data contained in ATQB (see ISO14443-3) */
|
||||
uint8_t abtApplicationData[4];
|
||||
/** abtProtocolInfo store Protocol Info contained in ATQB (see ISO14443-3) */
|
||||
/** abtProtocolInfo store Protocol Info contained in ATQB (see ISO14443-3) */
|
||||
uint8_t abtProtocolInfo[3];
|
||||
/** ui8CardIdentifier store CID (Card Identifier) attributted by PCD to the PICC */
|
||||
/** ui8CardIdentifier store CID (Card Identifier) attributted by PCD to the PICC */
|
||||
uint8_t ui8CardIdentifier;
|
||||
} nfc_iso14443b_info;
|
||||
|
||||
|
@ -206,13 +206,13 @@ typedef struct {
|
|||
* @brief NFC ISO14443B' tag information
|
||||
*/
|
||||
typedef struct {
|
||||
/** DIV: 4 LSBytes of tag serial number */
|
||||
/** DIV: 4 LSBytes of tag serial number */
|
||||
uint8_t abtDIV[4];
|
||||
/** Software version & type of REPGEN */
|
||||
/** Software version & type of REPGEN */
|
||||
uint8_t btVerLog;
|
||||
/** Config Byte, present if long REPGEN */
|
||||
/** Config Byte, present if long REPGEN */
|
||||
uint8_t btConfig;
|
||||
/** ATR, if any */
|
||||
/** ATR, if any */
|
||||
size_t szAtrLen;
|
||||
uint8_t abtAtr[33];
|
||||
} nfc_iso14443bi_info;
|
||||
|
|
|
@ -34,27 +34,27 @@
|
|||
# include <stdbool.h>
|
||||
|
||||
# ifdef _WIN32
|
||||
/* Windows platform */
|
||||
/* Windows platform */
|
||||
# ifndef _WINDLL
|
||||
/* CMake compilation */
|
||||
/* CMake compilation */
|
||||
# ifdef nfc_EXPORTS
|
||||
# define NFC_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
/* nfc_EXPORTS */
|
||||
/* nfc_EXPORTS */
|
||||
# define NFC_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
/* nfc_EXPORTS */
|
||||
/* nfc_EXPORTS */
|
||||
# else
|
||||
/* _WINDLL */
|
||||
/* Manual makefile */
|
||||
/* _WINDLL */
|
||||
/* Manual makefile */
|
||||
# define NFC_EXPORT
|
||||
# endif
|
||||
/* _WINDLL */
|
||||
/* _WINDLL */
|
||||
# else
|
||||
/* _WIN32 */
|
||||
/* _WIN32 */
|
||||
# define NFC_EXPORT
|
||||
# endif
|
||||
/* _WIN32 */
|
||||
/* _WIN32 */
|
||||
|
||||
# include <nfc/nfc-types.h>
|
||||
|
||||
|
@ -62,11 +62,11 @@
|
|||
extern "C" {
|
||||
# endif // __cplusplus
|
||||
|
||||
/* Library initialization/deinitialization */
|
||||
/* Library initialization/deinitialization */
|
||||
NFC_EXPORT void nfc_init(nfc_context *context);
|
||||
NFC_EXPORT void nfc_exit(nfc_context *context);
|
||||
|
||||
/* NFC Device/Hardware manipulation */
|
||||
/* NFC Device/Hardware manipulation */
|
||||
NFC_EXPORT bool nfc_get_default_device (nfc_connstring *connstring);
|
||||
NFC_EXPORT nfc_device *nfc_open (nfc_context *context, const nfc_connstring connstring);
|
||||
NFC_EXPORT void nfc_close (nfc_device *pnd);
|
||||
|
@ -74,7 +74,7 @@ extern "C" {
|
|||
NFC_EXPORT size_t nfc_list_devices (nfc_context *context, nfc_connstring connstrings[], size_t connstrings_len);
|
||||
NFC_EXPORT int nfc_idle (nfc_device *pnd);
|
||||
|
||||
/* NFC initiator: act as "reader" */
|
||||
/* NFC initiator: act as "reader" */
|
||||
NFC_EXPORT int nfc_initiator_init (nfc_device *pnd);
|
||||
NFC_EXPORT int nfc_initiator_select_passive_target (nfc_device *pnd, const nfc_modulation nm, const uint8_t *pbtInitData, const size_t szInitData, nfc_target *pnt);
|
||||
NFC_EXPORT int nfc_initiator_list_passive_targets (nfc_device *pnd, const nfc_modulation nm, nfc_target ant[], const size_t szTargets);
|
||||
|
@ -88,30 +88,30 @@ extern "C" {
|
|||
NFC_EXPORT int nfc_initiator_transceive_bits_timed (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar, uint32_t *cycles);
|
||||
NFC_EXPORT int nfc_initiator_target_is_present (nfc_device *pnd, const nfc_target nt);
|
||||
|
||||
/* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */
|
||||
/* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */
|
||||
NFC_EXPORT int nfc_target_init (nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const size_t szRx, int timeout);
|
||||
NFC_EXPORT int nfc_target_send_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout);
|
||||
NFC_EXPORT int nfc_target_receive_bytes (nfc_device *pnd, uint8_t *pbtRx, const size_t szRx, int timeout);
|
||||
NFC_EXPORT int nfc_target_send_bits (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar);
|
||||
NFC_EXPORT int nfc_target_receive_bits (nfc_device *pnd, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar);
|
||||
|
||||
/* Error reporting */
|
||||
/* Error reporting */
|
||||
NFC_EXPORT const char *nfc_strerror (const nfc_device *pnd);
|
||||
NFC_EXPORT int nfc_strerror_r (const nfc_device *pnd, char *buf, size_t buflen);
|
||||
NFC_EXPORT void nfc_perror (const nfc_device *pnd, const char *s);
|
||||
NFC_EXPORT int nfc_device_get_last_error (const nfc_device *pnd);
|
||||
|
||||
/* Special data accessors */
|
||||
/* Special data accessors */
|
||||
NFC_EXPORT const char *nfc_device_get_name (nfc_device *pnd);
|
||||
NFC_EXPORT const char *nfc_device_get_connstring (nfc_device *pnd);
|
||||
NFC_EXPORT int nfc_device_get_supported_modulation (nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt);
|
||||
NFC_EXPORT int nfc_device_get_supported_baud_rate (nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br);
|
||||
|
||||
/* Properties accessors */
|
||||
/* Properties accessors */
|
||||
NFC_EXPORT int nfc_device_set_property_int (nfc_device *pnd, const nfc_property property, const int value);
|
||||
NFC_EXPORT int nfc_device_set_property_bool (nfc_device *pnd, const nfc_property property, const bool bEnable);
|
||||
|
||||
/* Misc. functions */
|
||||
/* Misc. functions */
|
||||
NFC_EXPORT void iso14443a_crc (uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc);
|
||||
NFC_EXPORT void iso14443a_crc_append (uint8_t *pbtData, size_t szLen);
|
||||
NFC_EXPORT uint8_t *iso14443a_locate_historical_bytes (uint8_t *pbtAts, size_t szAts, size_t *pszTk);
|
||||
|
@ -119,73 +119,73 @@ extern "C" {
|
|||
NFC_EXPORT const char *nfc_version (void);
|
||||
NFC_EXPORT int nfc_device_get_information_about (nfc_device *pnd, char *buf, size_t buflen);
|
||||
|
||||
/* String converter functions */
|
||||
/* String converter functions */
|
||||
NFC_EXPORT const char * str_nfc_modulation_type (const nfc_modulation_type nmt);
|
||||
NFC_EXPORT const char * str_nfc_baud_rate (const nfc_baud_rate nbr);
|
||||
|
||||
|
||||
/* Error codes */
|
||||
/** @ingroup error
|
||||
/* Error codes */
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Success (no error)
|
||||
*/
|
||||
#define NFC_SUCCESS 0
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Input / output error, device may not be usable anymore without re-open it
|
||||
*/
|
||||
#define NFC_EIO -1
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Invalid argument(s)
|
||||
*/
|
||||
#define NFC_EINVARG -2
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Operation not supported by device
|
||||
*/
|
||||
#define NFC_EDEVNOTSUPP -3
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* No such device
|
||||
*/
|
||||
#define NFC_ENOTSUCHDEV -4
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Buffer overflow
|
||||
*/
|
||||
#define NFC_EOVFLOW -5
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Operation timed out
|
||||
*/
|
||||
#define NFC_ETIMEOUT -6
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Operation aborted (by user)
|
||||
*/
|
||||
#define NFC_EOPABORTED -7
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Not (yet) implemented
|
||||
*/
|
||||
#define NFC_ENOTIMPL -8
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Target released
|
||||
*/
|
||||
#define NFC_ETGRELEASED -10
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Error while RF transmission
|
||||
*/
|
||||
#define NFC_ERFTRANS -20
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Software error (allocation, file/pipe creation, etc.)
|
||||
*/
|
||||
#define NFC_ESOFT -80
|
||||
/** @ingroup error
|
||||
/** @ingroup error
|
||||
* @hideinitializer
|
||||
* Device's internal chip error
|
||||
*/
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#define LOG_CATEGORY "libnfc.bus.uart"
|
||||
|
||||
# if defined(__APPLE__)
|
||||
// FIXME: find UART connection string for PN53X device on Mac OS X when multiples devices are used
|
||||
// FIXME: find UART connection string for PN53X device on Mac OS X when multiples devices are used
|
||||
const char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", NULL };
|
||||
# elif defined (__FreeBSD__) || defined (__OpenBSD__)
|
||||
const char *serial_ports_device_radix[] = { "cuaU", "cuau", NULL };
|
||||
|
@ -60,7 +60,7 @@ const char *serial_ports_device_radix[] = { "ttyUSB", "ttyS", NULL };
|
|||
// Work-around to claim uart interface using the c_iflag (software input processing) from the termios struct
|
||||
# define CCLAIMED 0x80000000
|
||||
|
||||
struct serial_port_unix{
|
||||
struct serial_port_unix {
|
||||
int fd; // Serial port file descriptor
|
||||
struct termios termios_backup; // Terminal info before using the port
|
||||
struct termios termios_new; // Terminal info during the transaction
|
||||
|
|
|
@ -271,9 +271,9 @@ pn53x_transceive (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szT
|
|||
res = NFC_ECHIP;
|
||||
break;
|
||||
};
|
||||
/*
|
||||
/*
|
||||
{ EMFAUTH, "Mifare Authentication Error" },
|
||||
*/
|
||||
*/
|
||||
|
||||
if (res < 0) {
|
||||
pnd->last_error = res;
|
||||
|
@ -2367,7 +2367,7 @@ pn53x_InAutoPoll (struct nfc_device *pnd,
|
|||
uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||
size_t szRx = sizeof(abtRx);
|
||||
int res = pn53x_transceive (pnd, abtCmd, szTxInAutoPoll, abtRx, szRx, timeout);
|
||||
szRx = (size_t) res;
|
||||
szRx = (size_t) res;
|
||||
if (res < 0) {
|
||||
return res;
|
||||
} else if (szRx > 0) {
|
||||
|
@ -2742,40 +2742,40 @@ pn53x_ptt_to_nm( const pn53x_target_type ptt )
|
|||
|
||||
case PTT_MIFARE:
|
||||
case PTT_ISO14443_4A_106:
|
||||
return (const nfc_modulation){ .nmt = NMT_ISO14443A, .nbr = NBR_106 };
|
||||
return (const nfc_modulation) { .nmt = NMT_ISO14443A, .nbr = NBR_106 };
|
||||
break;
|
||||
|
||||
case PTT_ISO14443_4B_106:
|
||||
case PTT_ISO14443_4B_TCL_106:
|
||||
return (const nfc_modulation){ .nmt = NMT_ISO14443B, .nbr = NBR_106 };
|
||||
return (const nfc_modulation) { .nmt = NMT_ISO14443B, .nbr = NBR_106 };
|
||||
break;
|
||||
|
||||
case PTT_JEWEL_106:
|
||||
return (const nfc_modulation){ .nmt = NMT_JEWEL, .nbr = NBR_106 };
|
||||
return (const nfc_modulation) { .nmt = NMT_JEWEL, .nbr = NBR_106 };
|
||||
break;
|
||||
|
||||
case PTT_FELICA_212:
|
||||
return (const nfc_modulation){ .nmt = NMT_FELICA, .nbr = NBR_212 };
|
||||
return (const nfc_modulation) { .nmt = NMT_FELICA, .nbr = NBR_212 };
|
||||
break;
|
||||
case PTT_FELICA_424:
|
||||
return (const nfc_modulation){ .nmt = NMT_FELICA, .nbr = NBR_424 };
|
||||
return (const nfc_modulation) { .nmt = NMT_FELICA, .nbr = NBR_424 };
|
||||
break;
|
||||
|
||||
case PTT_DEP_PASSIVE_106:
|
||||
case PTT_DEP_ACTIVE_106:
|
||||
return (const nfc_modulation){ .nmt = NMT_DEP, .nbr = NBR_106 };
|
||||
return (const nfc_modulation) { .nmt = NMT_DEP, .nbr = NBR_106 };
|
||||
break;
|
||||
case PTT_DEP_PASSIVE_212:
|
||||
case PTT_DEP_ACTIVE_212:
|
||||
return (const nfc_modulation){ .nmt = NMT_DEP, .nbr = NBR_212 };
|
||||
return (const nfc_modulation) { .nmt = NMT_DEP, .nbr = NBR_212 };
|
||||
break;
|
||||
case PTT_DEP_PASSIVE_424:
|
||||
case PTT_DEP_ACTIVE_424:
|
||||
return (const nfc_modulation){ .nmt = NMT_DEP, .nbr = NBR_424 };
|
||||
return (const nfc_modulation) { .nmt = NMT_DEP, .nbr = NBR_424 };
|
||||
break;
|
||||
}
|
||||
// We should never be here, this line silent compilation warning
|
||||
return (const nfc_modulation){ .nmt = NMT_ISO14443A, .nbr = NBR_106 };
|
||||
return (const nfc_modulation) { .nmt = NMT_ISO14443A, .nbr = NBR_106 };
|
||||
}
|
||||
|
||||
pn53x_target_type
|
||||
|
|
|
@ -155,41 +155,41 @@ struct pn53x_io {
|
|||
* @brief PN53x data structure
|
||||
*/
|
||||
struct pn53x_data {
|
||||
/** Chip type (PN531, PN532 or PN533) */
|
||||
/** Chip type (PN531, PN532 or PN533) */
|
||||
pn53x_type type;
|
||||
/** Chip firmware text */
|
||||
/** Chip firmware text */
|
||||
char firmware_text[22];
|
||||
/** Current power mode */
|
||||
/** Current power mode */
|
||||
pn53x_power_mode power_mode;
|
||||
/** Current operating mode */
|
||||
/** Current operating mode */
|
||||
pn53x_operating_mode operating_mode;
|
||||
/** Current emulated target */
|
||||
/** Current emulated target */
|
||||
nfc_target *current_target;
|
||||
/** PN53x I/O functions stored in struct */
|
||||
/** PN53x I/O functions stored in struct */
|
||||
const struct pn53x_io *io;
|
||||
/** Last status byte returned by PN53x */
|
||||
/** Last status byte returned by PN53x */
|
||||
uint8_t last_status_byte;
|
||||
/** Register cache for REG_CIU_BIT_FRAMING, SYMBOL_TX_LAST_BITS: The last TX bits setting, we need to reset this if it does not apply anymore */
|
||||
/** Register cache for REG_CIU_BIT_FRAMING, SYMBOL_TX_LAST_BITS: The last TX bits setting, we need to reset this if it does not apply anymore */
|
||||
uint8_t ui8TxBits;
|
||||
/** Register cache for SetParameters function. */
|
||||
/** Register cache for SetParameters function. */
|
||||
uint8_t ui8Parameters;
|
||||
/** Last sent command */
|
||||
/** Last sent command */
|
||||
uint8_t last_command;
|
||||
/** Interframe timer correction */
|
||||
/** Interframe timer correction */
|
||||
int16_t timer_correction;
|
||||
/** Timer prescaler */
|
||||
/** Timer prescaler */
|
||||
uint16_t timer_prescaler;
|
||||
/** WriteBack cache */
|
||||
/** WriteBack cache */
|
||||
uint8_t wb_data[PN53X_CACHE_REGISTER_SIZE];
|
||||
uint8_t wb_mask[PN53X_CACHE_REGISTER_SIZE];
|
||||
bool wb_trigged;
|
||||
/** Command timeout */
|
||||
/** Command timeout */
|
||||
int timeout_command;
|
||||
/** ATR timeout */
|
||||
/** ATR timeout */
|
||||
int timeout_atr;
|
||||
/** Communication timeout */
|
||||
/** Communication timeout */
|
||||
int timeout_communication;
|
||||
/** Supported modulation type */
|
||||
/** Supported modulation type */
|
||||
nfc_modulation_type *supported_modulation_as_initiator;
|
||||
nfc_modulation_type *supported_modulation_as_target;
|
||||
};
|
||||
|
@ -203,21 +203,21 @@ struct pn53x_data {
|
|||
typedef enum {
|
||||
/** Undefined modulation */
|
||||
PM_UNDEFINED = -1,
|
||||
/** ISO14443-A (NXP MIFARE) http://en.wikipedia.org/wiki/MIFARE */
|
||||
/** ISO14443-A (NXP MIFARE) http://en.wikipedia.org/wiki/MIFARE */
|
||||
PM_ISO14443A_106 = 0x00,
|
||||
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */
|
||||
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */
|
||||
PM_FELICA_212 = 0x01,
|
||||
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */
|
||||
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */
|
||||
PM_FELICA_424 = 0x02,
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */
|
||||
PM_ISO14443B_106 = 0x03,
|
||||
/** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */
|
||||
/** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */
|
||||
PM_JEWEL_106 = 0x04,
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
PM_ISO14443B_212 = 0x06,
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
PM_ISO14443B_424 = 0x07,
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
PM_ISO14443B_847 = 0x08,
|
||||
} pn53x_modulation;
|
||||
|
||||
|
|
|
@ -56,15 +56,15 @@ Thanks to d18c7db and Okko for example code
|
|||
#include <errno.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
// Under POSIX system, we use libusb (>= 0.1.12)
|
||||
#include <usb.h>
|
||||
#define USB_TIMEDOUT ETIMEDOUT
|
||||
#define _usb_strerror( X ) strerror(-X)
|
||||
// Under POSIX system, we use libusb (>= 0.1.12)
|
||||
#include <usb.h>
|
||||
#define USB_TIMEDOUT ETIMEDOUT
|
||||
#define _usb_strerror( X ) strerror(-X)
|
||||
#else
|
||||
// Under Windows we use libusb-win32 (>= 1.2.5)
|
||||
#include <lusb0_usb.h>
|
||||
#define USB_TIMEDOUT 116
|
||||
#define _usb_strerror( X ) usb_strerror()
|
||||
// Under Windows we use libusb-win32 (>= 1.2.5)
|
||||
#include <lusb0_usb.h>
|
||||
#define USB_TIMEDOUT 116
|
||||
#define _usb_strerror( X ) usb_strerror()
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
|
|
@ -223,7 +223,7 @@ acr122s_send_frame(nfc_device *pnd, uint8_t *frame, int timeout)
|
|||
if ((ret = uart_receive(port, ack, 4, abort_p, timeout)) < 0)
|
||||
return ret;
|
||||
|
||||
if (memcmp(ack, positive_ack, 4) != 0){
|
||||
if (memcmp(ack, positive_ack, 4) != 0) {
|
||||
pnd->last_error = NFC_EIO;
|
||||
return pnd->last_error;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ acr122s_recv_frame(nfc_device *pnd, uint8_t *frame, size_t frame_size, void *abo
|
|||
return ret;
|
||||
|
||||
// Is buffer sufficient to store response?
|
||||
if (frame_size < FRAME_SIZE(frame)){
|
||||
if (frame_size < FRAME_SIZE(frame)) {
|
||||
pnd->last_error = NFC_EIO;
|
||||
return pnd->last_error;
|
||||
}
|
||||
|
|
|
@ -39,15 +39,15 @@ Thanks to d18c7db and Okko for example code
|
|||
#include <errno.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
// Under POSIX system, we use libusb (>= 0.1.12)
|
||||
#include <usb.h>
|
||||
#define USB_TIMEDOUT ETIMEDOUT
|
||||
#define _usb_strerror( X ) strerror(-X)
|
||||
// Under POSIX system, we use libusb (>= 0.1.12)
|
||||
#include <usb.h>
|
||||
#define USB_TIMEDOUT ETIMEDOUT
|
||||
#define _usb_strerror( X ) strerror(-X)
|
||||
#else
|
||||
// Under Windows we use libusb-win32 (>= 1.2.5)
|
||||
#include <lusb0_usb.h>
|
||||
#define USB_TIMEDOUT 116
|
||||
#define _usb_strerror( X ) usb_strerror()
|
||||
// Under Windows we use libusb-win32 (>= 1.2.5)
|
||||
#include <lusb0_usb.h>
|
||||
#define USB_TIMEDOUT 116
|
||||
#define _usb_strerror( X ) usb_strerror()
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
@ -684,8 +684,8 @@ pn53x_usb_init (nfc_device *pnd)
|
|||
/* Setup push-pulls for pins from P30 to P35 */
|
||||
pn53x_write_register (pnd, PN53X_SFR_P3CFGB, 0xFF, 0x37);
|
||||
|
||||
/*
|
||||
On ASK LoGO hardware:
|
||||
/*
|
||||
On ASK LoGO hardware:
|
||||
LEDs port bits definition:
|
||||
* LED 1: bit 2 (P32)
|
||||
* LED 2: bit 1 (P31)
|
||||
|
@ -700,7 +700,7 @@ On ASK LoGO hardware:
|
|||
To use this feature we have to switch on the field by switching on
|
||||
the field on PN533 (RFConfiguration) then set P34 to '1', and cut-off the
|
||||
field by switching off the field on PN533 then set P34 to '0'.
|
||||
*/
|
||||
*/
|
||||
|
||||
/* Set P30, P31, P33, P35 to logic 1 and P32, P34 to 0 logic */
|
||||
/* ie. Switch LED1 on and turn off progressive field */
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file iso14443-subr.c
|
||||
* @brief Defines some function extracted for ISO/IEC 14443
|
||||
*/
|
||||
/**
|
||||
* @file iso14443-subr.c
|
||||
* @brief Defines some function extracted for ISO/IEC 14443
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file iso7816.h
|
||||
* @brief Defines some macros extracted for ISO/IEC 7816-4
|
||||
*/
|
||||
/**
|
||||
* @file iso7816.h
|
||||
* @brief Defines some macros extracted for ISO/IEC 7816-4
|
||||
*/
|
||||
|
||||
#ifndef __LIBNFC_ISO7816_H__
|
||||
#define __LIBNFC_ISO7816_H__
|
||||
|
|
62
libnfc/log.h
62
libnfc/log.h
|
@ -32,43 +32,43 @@
|
|||
# define __has_attribute_format 1
|
||||
# endif
|
||||
|
||||
// User want debug features
|
||||
#define LOGGING 1
|
||||
int log_init (void);
|
||||
int log_fini (void);
|
||||
void log_put (const char *category, const char *priority, const char *format, ...)
|
||||
// User want debug features
|
||||
#define LOGGING 1
|
||||
int log_init (void);
|
||||
int log_fini (void);
|
||||
void log_put (const char *category, const char *priority, const char *format, ...)
|
||||
# if __has_attribute_format
|
||||
__attribute__((format(printf, 3, 4)))
|
||||
__attribute__((format(printf, 3, 4)))
|
||||
# endif
|
||||
;
|
||||
;
|
||||
|
||||
|
||||
#define NFC_PRIORITY_FATAL "fatal"
|
||||
#define NFC_PRIORITY_ALERT "alert"
|
||||
#define NFC_PRIORITY_CRIT "critical"
|
||||
#define NFC_PRIORITY_ERROR "error"
|
||||
#define NFC_PRIORITY_WARN "warning"
|
||||
#define NFC_PRIORITY_NOTICE "notice"
|
||||
#define NFC_PRIORITY_INFO "info"
|
||||
#define NFC_PRIORITY_DEBUG "debug"
|
||||
#define NFC_PRIORITY_TRACE "trace"
|
||||
#define NFC_PRIORITY_FATAL "fatal"
|
||||
#define NFC_PRIORITY_ALERT "alert"
|
||||
#define NFC_PRIORITY_CRIT "critical"
|
||||
#define NFC_PRIORITY_ERROR "error"
|
||||
#define NFC_PRIORITY_WARN "warning"
|
||||
#define NFC_PRIORITY_NOTICE "notice"
|
||||
#define NFC_PRIORITY_INFO "info"
|
||||
#define NFC_PRIORITY_DEBUG "debug"
|
||||
#define NFC_PRIORITY_TRACE "trace"
|
||||
#else
|
||||
// No logging
|
||||
#define log_init() ((void) 0)
|
||||
#define log_fini() ((void) 0)
|
||||
#define log_msg(category, priority, message) do {} while (0)
|
||||
#define log_set_appender(category, appender) do {} while (0)
|
||||
#define log_put(category, priority, format, ...) do {} while (0)
|
||||
// No logging
|
||||
#define log_init() ((void) 0)
|
||||
#define log_fini() ((void) 0)
|
||||
#define log_msg(category, priority, message) do {} while (0)
|
||||
#define log_set_appender(category, appender) do {} while (0)
|
||||
#define log_put(category, priority, format, ...) do {} while (0)
|
||||
|
||||
#define NFC_PRIORITY_FATAL 8
|
||||
#define NFC_PRIORITY_ALERT 7
|
||||
#define NFC_PRIORITY_CRIT 6
|
||||
#define NFC_PRIORITY_ERROR 5
|
||||
#define NFC_PRIORITY_WARN 4
|
||||
#define NFC_PRIORITY_NOTICE 3
|
||||
#define NFC_PRIORITY_INFO 2
|
||||
#define NFC_PRIORITY_DEBUG 1
|
||||
#define NFC_PRIORITY_TRACE 0
|
||||
#define NFC_PRIORITY_FATAL 8
|
||||
#define NFC_PRIORITY_ALERT 7
|
||||
#define NFC_PRIORITY_CRIT 6
|
||||
#define NFC_PRIORITY_ERROR 5
|
||||
#define NFC_PRIORITY_WARN 4
|
||||
#define NFC_PRIORITY_NOTICE 3
|
||||
#define NFC_PRIORITY_INFO 2
|
||||
#define NFC_PRIORITY_DEBUG 1
|
||||
#define NFC_PRIORITY_TRACE 0
|
||||
#endif /* HAS_LOG4C, DEBUG */
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file mirror-subr.c
|
||||
* @brief Mirror bytes
|
||||
*/
|
||||
/**
|
||||
* @file mirror-subr.c
|
||||
* @brief Mirror bytes
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file nfc-device.c
|
||||
* @brief Provide internal function to manipulate nfc_device type
|
||||
*/
|
||||
/**
|
||||
* @file nfc-device.c
|
||||
* @brief Provide internal function to manipulate nfc_device type
|
||||
*/
|
||||
|
||||
/* vim:set et sw=2 ts=2: */
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file nfc-emulation.c
|
||||
* @brief Provide a small API to ease emulation in libnfc
|
||||
*/
|
||||
/**
|
||||
* @file nfc-emulation.c
|
||||
* @brief Provide a small API to ease emulation in libnfc
|
||||
*/
|
||||
|
||||
#include <nfc/nfc.h>
|
||||
#include <nfc/nfc-emulation.h>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file nfc-internal.c
|
||||
* @brief Provide some useful internal functions
|
||||
*/
|
||||
/**
|
||||
* @file nfc-internal.c
|
||||
* @brief Provide some useful internal functions
|
||||
*/
|
||||
|
||||
#include <nfc/nfc.h>
|
||||
#include "nfc-internal.h"
|
||||
|
|
|
@ -179,22 +179,22 @@ struct nfc_device {
|
|||
void *driver_data;
|
||||
void *chip_data;
|
||||
|
||||
/** Device name string, including device wrapper firmware */
|
||||
/** Device name string, including device wrapper firmware */
|
||||
char name[DEVICE_NAME_LENGTH];
|
||||
/** Device connection string */
|
||||
/** Device connection string */
|
||||
nfc_connstring connstring;
|
||||
/** Is the CRC automaticly added, checked and removed from the frames */
|
||||
/** Is the CRC automaticly added, checked and removed from the frames */
|
||||
bool bCrc;
|
||||
/** Does the chip handle parity bits, all parities are handled as data */
|
||||
/** Does the chip handle parity bits, all parities are handled as data */
|
||||
bool bPar;
|
||||
/** Should the chip handle frames encapsulation and chaining */
|
||||
/** Should the chip handle frames encapsulation and chaining */
|
||||
bool bEasyFraming;
|
||||
/** Should the chip switch automatically activate ISO14443-4 when
|
||||
/** Should the chip switch automatically activate ISO14443-4 when
|
||||
selecting tags supporting it? */
|
||||
bool bAutoIso14443_4;
|
||||
/** Supported modulation encoded in a byte */
|
||||
/** Supported modulation encoded in a byte */
|
||||
uint8_t btSupportByte;
|
||||
/** Last reported error */
|
||||
/** Last reported error */
|
||||
int last_error;
|
||||
};
|
||||
|
||||
|
|
|
@ -53,34 +53,48 @@ struct card_sak
|
|||
};
|
||||
|
||||
struct card_atqa const_ca[] = {
|
||||
{0x0044, 0xffff, "MIFARE Ultralight",
|
||||
{0, -1} },
|
||||
{0x0044, 0xffff, "MIFARE Ultralight C",
|
||||
{0, -1} },
|
||||
{0x0004, 0xff0f, "MIFARE Mini 0.3K",
|
||||
{1, -1} },
|
||||
{0x0004, 0xff0f, "MIFARE Classic 1K",
|
||||
{2, -1} },
|
||||
{0x0002, 0xff0f, "MIFARE Classic 4K",
|
||||
{3, -1} },
|
||||
{0x0004, 0xffff, "MIFARE Plus (4 Byte UID or 4 Byte RID)",
|
||||
{4, 5, 6, 7, 8, 9, -1} },
|
||||
{0x0002, 0xffff, "MIFARE Plus (4 Byte UID or 4 Byte RID)",
|
||||
{4, 5, 6, 7, 8, 9, -1} },
|
||||
{0x0044, 0xffff, "MIFARE Plus (7 Byte UID)",
|
||||
{4, 5, 6, 7, 8, 9, -1} },
|
||||
{0x0042, 0xffff, "MIFARE Plus (7 Byte UID)",
|
||||
{4, 5, 6, 7, 8, 9, -1} },
|
||||
{0x0344, 0xffff, "MIFARE DESFire",
|
||||
{10, 11, -1} },
|
||||
{0x0044, 0xffff, "P3SR008",
|
||||
{-1} }, // TODO we need SAK info
|
||||
{0x0004, 0xf0ff, "SmartMX with MIFARE 1K emulation",
|
||||
{12, -1} },
|
||||
{0x0002, 0xf0ff, "SmartMX with MIFARE 4K emulation",
|
||||
{12, -1} },
|
||||
{0x0048, 0xf0ff, "SmartMX with 7 Byte UID",
|
||||
{12, -1} }
|
||||
{ 0x0044, 0xffff, "MIFARE Ultralight",
|
||||
{0, -1}
|
||||
},
|
||||
{ 0x0044, 0xffff, "MIFARE Ultralight C",
|
||||
{0, -1}
|
||||
},
|
||||
{ 0x0004, 0xff0f, "MIFARE Mini 0.3K",
|
||||
{1, -1}
|
||||
},
|
||||
{ 0x0004, 0xff0f, "MIFARE Classic 1K",
|
||||
{2, -1}
|
||||
},
|
||||
{ 0x0002, 0xff0f, "MIFARE Classic 4K",
|
||||
{3, -1}
|
||||
},
|
||||
{ 0x0004, 0xffff, "MIFARE Plus (4 Byte UID or 4 Byte RID)",
|
||||
{4, 5, 6, 7, 8, 9, -1}
|
||||
},
|
||||
{ 0x0002, 0xffff, "MIFARE Plus (4 Byte UID or 4 Byte RID)",
|
||||
{4, 5, 6, 7, 8, 9, -1}
|
||||
},
|
||||
{ 0x0044, 0xffff, "MIFARE Plus (7 Byte UID)",
|
||||
{4, 5, 6, 7, 8, 9, -1}
|
||||
},
|
||||
{ 0x0042, 0xffff, "MIFARE Plus (7 Byte UID)",
|
||||
{4, 5, 6, 7, 8, 9, -1}
|
||||
},
|
||||
{ 0x0344, 0xffff, "MIFARE DESFire",
|
||||
{10, 11, -1}
|
||||
},
|
||||
{ 0x0044, 0xffff, "P3SR008",
|
||||
{-1}
|
||||
}, // TODO we need SAK info
|
||||
{ 0x0004, 0xf0ff, "SmartMX with MIFARE 1K emulation",
|
||||
{12, -1}
|
||||
},
|
||||
{ 0x0002, 0xf0ff, "SmartMX with MIFARE 4K emulation",
|
||||
{12, -1}
|
||||
},
|
||||
{ 0x0048, 0xf0ff, "SmartMX with 7 Byte UID",
|
||||
{12, -1}
|
||||
}
|
||||
};
|
||||
|
||||
struct card_sak const_cs[] = {
|
||||
|
@ -609,7 +623,7 @@ print_nfc_iso14443bi_info (const nfc_iso14443bi_info nii, bool verbose)
|
|||
printf ("%i\n", version);
|
||||
}
|
||||
|
||||
if ((nii.btVerLog & 0x80) && (nii.btConfig & 0x80)){
|
||||
if ((nii.btVerLog & 0x80) && (nii.btConfig & 0x80)) {
|
||||
printf (" Wait Enable: yes");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -361,27 +361,27 @@ extern "C" {
|
|||
|
||||
/* Windows specific functions */
|
||||
|
||||
#define LIBUSB_HAS_INSTALL_SERVICE_NP 1
|
||||
#define LIBUSB_HAS_INSTALL_SERVICE_NP 1
|
||||
int usb_install_service_np(void);
|
||||
void CALLBACK usb_install_service_np_rundll(HWND wnd, HINSTANCE instance,
|
||||
LPSTR cmd_line, int cmd_show);
|
||||
|
||||
#define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1
|
||||
#define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1
|
||||
int usb_uninstall_service_np(void);
|
||||
void CALLBACK usb_uninstall_service_np_rundll(HWND wnd, HINSTANCE instance,
|
||||
LPSTR cmd_line, int cmd_show);
|
||||
|
||||
#define LIBUSB_HAS_INSTALL_DRIVER_NP 1
|
||||
#define LIBUSB_HAS_INSTALL_DRIVER_NP 1
|
||||
int usb_install_driver_np(const char *inf_file);
|
||||
void CALLBACK usb_install_driver_np_rundll(HWND wnd, HINSTANCE instance,
|
||||
LPSTR cmd_line, int cmd_show);
|
||||
|
||||
#define LIBUSB_HAS_TOUCH_INF_FILE_NP 1
|
||||
#define LIBUSB_HAS_TOUCH_INF_FILE_NP 1
|
||||
int usb_touch_inf_file_np(const char *inf_file);
|
||||
void CALLBACK usb_touch_inf_file_np_rundll(HWND wnd, HINSTANCE instance,
|
||||
LPSTR cmd_line, int cmd_show);
|
||||
|
||||
#define LIBUSB_HAS_INSTALL_NEEDS_RESTART_NP 1
|
||||
#define LIBUSB_HAS_INSTALL_NEEDS_RESTART_NP 1
|
||||
int usb_install_needs_restart_np(void);
|
||||
|
||||
const struct usb_version *usb_get_version(void);
|
||||
|
|
Loading…
Reference in a new issue