aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGergő J. Miklós2020-10-09 02:13:04 +0200
committerGergő J. Miklós2020-10-09 02:13:04 +0200
commite6d02c5809381911236d6384ff5826e419de9939 (patch)
treeb8e3369719088189d68d55fc96cb392aa023965c
parenta44e57ef396abcc3d350ab95f007392c96d286d9 (diff)
downloadi2sensors-e6d02c5809381911236d6384ff5826e419de9939.tar.gz
i2sensors-e6d02c5809381911236d6384ff5826e419de9939.zip
plus error handling
-rw-r--r--src/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 0c7e800..09afe49 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,14 +67,14 @@ void bus_err(int ern){
uchar *xchg_data (uchar *buf, uint16 wrlen, uint16 waitlen, uint16 rdlen){ //# [buf] = 32 byte
if(write(devicef, buf, wrlen) != wrlen){ //# write one byte to device
- printf("I2C communication(wr) error. errno: %d\n",errno);
- perror(errno);
+ perror("I2C communication(wr) error.");
+ printf("errno: %d\n",errno);
}
usleep(waitlen*1000); //# Wait 10ms for reading
if(read(devicef, buf, rdlen) != rdlen) { //# read the result
- printf("I2C communication(rd) error. errno: %d\n",errno);
- perror(errno);
+ perror("I2C communication(rd) error.");
+ printf("errno: %d\n",errno);
}
return buf;
}