aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGergő J. Miklós2020-10-11 04:22:32 +0200
committerGergő J. Miklós2020-10-11 04:22:32 +0200
commitf54acfb6b701e5008887b9d15560abc3d8e1686d (patch)
treed14971ebb7cfb684b2c368946d578e39fd75fd79
parentccd5baad28186f67c3466e5caf20c88ea3254bd8 (diff)
downloadi2sensors-f54acfb6b701e5008887b9d15560abc3d8e1686d.tar.gz
i2sensors-f54acfb6b701e5008887b9d15560abc3d8e1686d.zip
error handling
-rw-r--r--src/main.c4
1 files 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;
}