From f54acfb6b701e5008887b9d15560abc3d8e1686d Mon Sep 17 00:00:00 2001 From: Gergő J. Miklós Date: Sun, 11 Oct 2020 04:22:32 +0200 Subject: error handling --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 4d4f4ca..8414892 100644 --- a/src/main.c +++ b/src/main.c @@ -73,13 +73,13 @@ uchar *xchg_data (uchar *buf, uint16 wrlen, uint16 waitlen, uint16 rdlen){ if(write(devicef, buf, 1) != 1){ //# write one byte to device //perror("I2C communication(wrr) error."); - fprintf (stderr, "I2C communication(WR) error: [%d, %s] at %s, line %d. (function: %s)\n", errno, strerror(errno), __FILE__, __LINE__, __func__); + fprintf (stderr, "I2C write error: [NO: %d, MSG: %s] at %s, line %d. (function: %s)\n", errno, strerror(errno), __FILE__, __LINE__, __func__); } usleep(waitlen*1000); //# Wait 10ms for reading if(read(devicef, buf, rdlen) != rdlen) { //# read the result //perror("I2C communication(rd) error."); - fprintf (stderr, "I2C communication(RD) error: [%d, %s] at %s, line %d. (function: %s)\n", errno, strerror(errno), __FILE__, __LINE__, __func__); + fprintf (stderr, "I2C read error: [NO: %d, MSG: %s] at %s, line %d. (function: %s)\n", errno, strerror(errno), __FILE__, __LINE__, __func__); } return buf; } -- cgit v1.2.3