Merge pull request #366 from oliv3r/master

Improve logging and allow building of debian packages
This commit is contained in:
Philippe Teuwen 2017-02-17 10:15:27 +01:00 committed by GitHub
commit 7e3a7a6d05
2 changed files with 9 additions and 1 deletions

View file

@ -63,6 +63,8 @@ ENDIF(LIBNFC_CONFFILES_MODE)
option (BUILD_EXAMPLES "build examples ON/OFF" ON) option (BUILD_EXAMPLES "build examples ON/OFF" ON)
option (BUILD_UTILS "build utils ON/OFF" ON) option (BUILD_UTILS "build utils ON/OFF" ON)
option (BUILD_DEBPKG "build debian package ON/OFF" OFF)
# Doxygen # Doxygen
SET(builddir "${CMAKE_BINARY_DIR}") SET(builddir "${CMAKE_BINARY_DIR}")
@ -224,10 +226,14 @@ IF(WIN32)
SET(CPACK_GENERATOR "ZIP") SET(CPACK_GENERATOR "ZIP")
ELSE(WIN32) ELSE(WIN32)
SET(CPACK_GENERATOR "TBZ2") SET(CPACK_GENERATOR "TBZ2")
IF(BUILD_DEBPKG)
SET(CPACK_GENERATOR "DEB")
ENDIF(BUILD_DEBPKG)
ENDIF(WIN32) ENDIF(WIN32)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Near Field Communication (NFC) library") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Near Field Communication (NFC) library")
SET(CPACK_PACKAGE_VENDOR "Roel Verdult") SET(CPACK_PACKAGE_VENDOR "Roel Verdult")
SET(CPACK_PACKAGE_CONTACT "Roel Verdul <roel@libnfc.org>")
#Readme file #Readme file
IF(WIN32) IF(WIN32)

View file

@ -135,6 +135,8 @@ i2c_read(i2c_device id, uint8_t *pbtRx, const size_t szRx)
if (recCount < 0) { if (recCount < 0) {
res = NFC_EIO; res = NFC_EIO;
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR,
"Error: read only %d bytes (%d expected) (%s).", (int)recCount, (int) szRx, strerror(errno));
} else { } else {
if (recCount < (ssize_t)szRx) { if (recCount < (ssize_t)szRx) {
res = NFC_EINVARG; res = NFC_EINVARG;
@ -167,7 +169,7 @@ i2c_write(i2c_device id, const uint8_t *pbtTx, const size_t szTx)
return NFC_SUCCESS; return NFC_SUCCESS;
} else { } else {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR,
"Error: wrote only %d bytes (%d expected).", (int)writeCount, (int) szTx); "Error: wrote only %d bytes (%d expected) (%s).", (int)writeCount, (int) szTx, strerror(errno));
return NFC_EIO; return NFC_EIO;
} }
} }