aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGergő J. Miklós2020-10-15 05:11:05 +0200
committerGergő J. Miklós2020-10-15 05:11:05 +0200
commit06d3cf11147a363cbc5d0c5487beadbfc1e03306 (patch)
tree15bb77ac23d5efdf38c5bda407bed2fd3a335581
parentdffa37c77d2d5ce30ec408626502541861637d9d (diff)
downloadi2sensors-06d3cf11147a363cbc5d0c5487beadbfc1e03306.tar.gz
i2sensors-06d3cf11147a363cbc5d0c5487beadbfc1e03306.zip
i2sensors: some comment & verbose
-rw-r--r--src/main.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index 4a4b15d..26e79ba 100644
--- a/src/main.c
+++ b/src/main.c
@@ -79,12 +79,7 @@ void print_help(void) {
printf ("Version: v%1.2f, build: [%s] (gcc %s) \n\n",VERSION,_BUILD_TIME_,__VERSION__);
}
-/*
-void bus_err(int ern){
- printf("I2C communication(rd) error. errno: %d\n",errno);
- //fprintf (stderr, "Internal error %d at %s, line %d. (function: %s/%s)\n", ern, __FILE__, __LINE__, __func__, __FUNCTION__);
-}
-*/
+
__uint8_t *xchg_data (__uint8_t *buf, __uint16_t wrlen, __uint16_t waitlen, __uint16_t rdlen){ //# [buf] = 32 byte
@@ -150,17 +145,10 @@ int main( int argc, char *argv[] ){
char filename[256];
int i, file1;
-/* for( i = 0; i < strlen(argv[2]); i++){ //# Test on bus address, for error detection.
- if(!isdigit(argv[2][i])){
- printf("\n\tThe BUS Address must be an integer!\n\n");
- exit(EXIT_FAILURE);
- }
- }
-*/
snprintf(filename, 256, "/dev/i2c-%s", argv[2]);
devicef = open(filename, O_RDWR); //# Open the i2c bus
if (devicef < 0){
- printf("\n\tCan't open i2c BUS. Have you any permission?\n\n");
+ printf("\n\tCan't open \"%s\" BUS. (Have you any permission?)\n\n", filename);
exit(EXIT_FAILURE);
}