Code cleanup, it removes some warnings and should fix Issue 35.
This commit is contained in:
parent
4426599638
commit
88a4ae8043
6 changed files with 23 additions and 22 deletions
|
@ -173,8 +173,8 @@ bool dev_pn531_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
{
|
||||
size_t uiPos = 0;
|
||||
int ret = 0;
|
||||
char abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||
char abtRx[BUFFER_LENGTH];
|
||||
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||
byte_t abtRx[BUFFER_LENGTH];
|
||||
dev_spec_pn531* pdsp = (dev_spec_pn531*)ds;
|
||||
|
||||
// Packet length = data length (len) + checksum (1) + end of stream marker (1)
|
||||
|
@ -196,10 +196,10 @@ bool dev_pn531_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
|
||||
#ifdef DEBUG
|
||||
printf("Tx: ");
|
||||
print_hex((byte_t*)abtTx,szTxLen+7);
|
||||
print_hex(abtTx,szTxLen+7);
|
||||
#endif
|
||||
|
||||
ret = usb_bulk_write(pdsp->pudh, pdsp->uiEndPointOut, abtTx, szTxLen+7, USB_TIMEOUT);
|
||||
ret = usb_bulk_write(pdsp->pudh, pdsp->uiEndPointOut, (char*)abtTx, szTxLen+7, USB_TIMEOUT);
|
||||
if( ret < 0 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -208,7 +208,7 @@ bool dev_pn531_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
return false;
|
||||
}
|
||||
|
||||
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
if( ret < 0 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -219,12 +219,12 @@ bool dev_pn531_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
|
||||
#ifdef DEBUG
|
||||
printf("Rx: ");
|
||||
print_hex((byte_t*)abtRx,ret);
|
||||
print_hex(abtRx,ret);
|
||||
#endif
|
||||
|
||||
if( ret == 6 )
|
||||
{
|
||||
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
if( ret < 0 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -235,7 +235,7 @@ bool dev_pn531_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
|
||||
#ifdef DEBUG
|
||||
printf("Rx: ");
|
||||
print_hex((byte_t*)abtRx,ret);
|
||||
print_hex(abtRx,ret);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -168,8 +168,8 @@ bool dev_pn533_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
{
|
||||
size_t uiPos = 0;
|
||||
int ret = 0;
|
||||
char abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||
char abtRx[BUFFER_LENGTH];
|
||||
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||
byte_t abtRx[BUFFER_LENGTH];
|
||||
dev_spec_pn533* pdsp = (dev_spec_pn533*)ds;
|
||||
|
||||
// Packet length = data length (len) + checksum (1) + end of stream marker (1)
|
||||
|
@ -191,10 +191,10 @@ bool dev_pn533_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
|
||||
#ifdef DEBUG
|
||||
printf(" TX: ");
|
||||
print_hex((byte_t*)abtTx,szTxLen+7);
|
||||
print_hex(abtTx,szTxLen+7);
|
||||
#endif
|
||||
|
||||
ret = usb_bulk_write(pdsp->pudh, pdsp->uiEndPointOut, abtTx, szTxLen+7, USB_TIMEOUT);
|
||||
ret = usb_bulk_write(pdsp->pudh, pdsp->uiEndPointOut, (char*)abtTx, szTxLen+7, USB_TIMEOUT);
|
||||
if( ret < 0 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -203,7 +203,7 @@ bool dev_pn533_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
return false;
|
||||
}
|
||||
|
||||
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
if( ret < 0 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -214,12 +214,12 @@ bool dev_pn533_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex((byte_t*)abtRx,ret);
|
||||
print_hex(abtRx,ret);
|
||||
#endif
|
||||
|
||||
if( ret == 6 )
|
||||
{
|
||||
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
ret = usb_bulk_read(pdsp->pudh, pdsp->uiEndPointIn, (char*)abtRx, BUFFER_LENGTH, USB_TIMEOUT);
|
||||
if( ret < 0 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
|
@ -230,7 +230,7 @@ bool dev_pn533_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex((byte_t*)abtRx,ret);
|
||||
print_hex(abtRx,ret);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ bool dev_pn533_transceive(const dev_spec ds, const byte_t* pbtTx, const size_t s
|
|||
*pszRxLen = ret - 7 - 2;
|
||||
|
||||
// Get register: nuke extra byte (awful hack)
|
||||
if ((abtRx[5]==(char)0xd5) && (abtRx[6]==(char)0x07) && (*pszRxLen==2)) {
|
||||
if ((abtRx[5]==0xd5) && (abtRx[6]==0x07) && (*pszRxLen==2)) {
|
||||
// printf("Got %02x %02x, keep %02x\n", abtRx[7], abtRx[8], abtRx[8]);
|
||||
*pszRxLen = (*pszRxLen) - 1;
|
||||
memcpy( pbtRx, abtRx + 8, *pszRxLen);
|
||||
|
|
|
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
|
|||
for(i= 0; i < 4; ++i)
|
||||
{
|
||||
memcpy(abtTmp,argv[arg]+i*2,2);
|
||||
abtUidBcc[i]= (byte_t) strtol(abtTmp,NULL,16);
|
||||
abtUidBcc[i]= (byte_t) strtol((char*)abtTmp,NULL,16);
|
||||
abtUidBcc[4] ^= abtUidBcc[i];
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -22,7 +22,7 @@ int main(int argc, const char *argv[])
|
|||
printf("Sending : %s\n", send);
|
||||
if (!nfc_initiator_transceive_dep_bytes(pdi,
|
||||
send,
|
||||
strlen(send), abtRecv,
|
||||
strlen((char*)send), abtRecv,
|
||||
&szRecvBits)) {
|
||||
printf("unable to send data\n");
|
||||
return 1;
|
||||
|
|
|
@ -92,7 +92,7 @@ int main(int argc, const char* argv[])
|
|||
}
|
||||
|
||||
// Poll for a ISO14443B tag
|
||||
if (nfc_initiator_select_tag(pdi,IM_ISO14443B_106,"\x00",1,&ti))
|
||||
if (nfc_initiator_select_tag(pdi,IM_ISO14443B_106,(byte_t*)"\x00",1,&ti))
|
||||
{
|
||||
printf("The following (NFC) ISO14443-B tag was found:\n\n");
|
||||
printf(" ATQB: "); print_hex(ti.tib.abtAtqb,12);
|
||||
|
|
|
@ -31,6 +31,7 @@ available: http://www.teuniz.net/RS-232/index.html
|
|||
// Test if we are dealing with unix operating systems
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <termios.h>
|
||||
typedef struct termios term_info;
|
||||
typedef struct {
|
||||
int fd; // Serial port file descriptor
|
||||
|
@ -124,8 +125,8 @@ void rs232_set_speed(serial_port sp, const uint32_t uiPortSpeed)
|
|||
#endif
|
||||
};
|
||||
const serial_port_unix* spu = (serial_port_unix*)sp;
|
||||
cfsetispeed(&spu->tiNew, stPortSpeed);
|
||||
cfsetospeed(&spu->tiNew, stPortSpeed);
|
||||
cfsetispeed((struct termios*)&spu->tiNew, stPortSpeed);
|
||||
cfsetospeed((struct termios*)&spu->tiNew, stPortSpeed);
|
||||
if( tcsetattr(spu->fd, TCSADRAIN, &spu->tiNew) == -1)
|
||||
{
|
||||
ERR("Unable to apply new speed settings.");
|
||||
|
|
Loading…
Reference in a new issue