From 06d3cf11147a363cbc5d0c5487beadbfc1e03306 Mon Sep 17 00:00:00 2001 From: Gergő J. Miklós Date: Thu, 15 Oct 2020 05:11:05 +0200 Subject: i2sensors: some comment & verbose --- src/main.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3