diff --git a/libnfc/drivers/acr122.c b/libnfc/drivers/acr122.c index b0d3ae7..b617eca 100644 --- a/libnfc/drivers/acr122.c +++ b/libnfc/drivers/acr122.c @@ -37,15 +37,25 @@ // Bus #include -#ifdef __APPLE__ +// XXX: Some review from users cross-compiling is welcome! +#if defined (_WIN32) +# define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE SCARD_CTL_CODE(3500) +#elif defined(__APPLE__) # include +# define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE (((0x31) << 16) | ((3500) << 2)) +#elif defined (__FreeBSD__) || defined (__OpenBSD__) +# define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE (((0x31) << 16) | ((3500) << 2)) +#elif defined (__linux__) +# include +// Escape IOCTL tested successfully: +# define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE SCARD_CTL_CODE(1) +#else +# error "Can't determine serial string for your system" #endif #include #include -// WINDOWS: #define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE SCARD_CTL_CODE(3500) -#define IOCTL_CCID_ESCAPE_SCARD_CTL_CODE (((0x31) << 16) | ((3500) << 2)) #define SCARD_OPERATION_SUCCESS 0x61 #define SCARD_OPERATION_ERROR 0x63