diff options
author | Gergő J. Miklós | 2020-10-11 04:22:32 +0200 |
---|---|---|
committer | Gergő J. Miklós | 2020-10-11 04:22:32 +0200 |
commit | f54acfb6b701e5008887b9d15560abc3d8e1686d (patch) | |
tree | d14971ebb7cfb684b2c368946d578e39fd75fd79 | |
parent | ccd5baad28186f67c3466e5caf20c88ea3254bd8 (diff) | |
download | i2sensors-f54acfb6b701e5008887b9d15560abc3d8e1686d.tar.gz i2sensors-f54acfb6b701e5008887b9d15560abc3d8e1686d.zip |
error handling
-rw-r--r-- | src/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |