Minor code cleanning.

This commit is contained in:
Romuald Conty 2010-07-29 12:47:51 +00:00
parent f01b73ab32
commit fc15146bf2

View file

@ -229,12 +229,17 @@ void pn53x_usb_disconnect(nfc_device_t* pnd)
usb_spec_t* pus = (usb_spec_t*)pnd->nds; usb_spec_t* pus = (usb_spec_t*)pnd->nds;
int ret; int ret;
if((ret = usb_release_interface(pus->pudh,0)) < 0) if((ret = usb_release_interface(pus->pudh,0)) < 0) {
DBG("usb_release failed %i",ret); DBG("usb_release failed %i",ret);
DBG("%s","resetting USB"); }
if((ret = usb_close(pus->pudh)) < 0)
if((ret = usb_close(pus->pudh)) < 0) {
DBG("usb_close failed %i",ret); DBG("usb_close failed %i",ret);
}
DBG("%s","resetting USB");
usb_reset(pus->pudh); usb_reset(pus->pudh);
free(pnd->nds); free(pnd->nds);
free(pnd); free(pnd);
DBG("%s","done!"); DBG("%s","done!");
@ -317,7 +322,7 @@ bool pn53x_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, cons
// Get register: nuke extra byte (awful hack) // Get register: nuke extra byte (awful hack)
if ((abtRx[5]==0xd5) && (abtRx[6]==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]); // DBG("awful hack: abtRx[7]=%02x, abtRx[8]=%02x, we only keep abtRx[8]=%02x", abtRx[7], abtRx[8], abtRx[8]);
*pszRxLen = (*pszRxLen) - 1; *pszRxLen = (*pszRxLen) - 1;
memcpy( pbtRx, abtRx + 8, *pszRxLen); memcpy( pbtRx, abtRx + 8, *pszRxLen);
return true; return true;