From 8d51fefcc51e2d5d6dd554d21d06686af8031258 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Sat, 8 Aug 2020 17:45:35 -0400 Subject: [PATCH] Update telem.c --- afsk/telem.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/afsk/telem.c b/afsk/telem.c index 90740bc4..0dfaa75a 100644 --- a/afsk/telem.c +++ b/afsk/telem.c @@ -133,21 +133,23 @@ struct SensorConfig config_sensor(char *bus, int address, int milliAmps) { char command[50] = "timeout 5 i2cdetect -y "; strcat (command, &bus[pos]); - FILE *i2cdetect = popen(command, "r"); +// FILE *i2cdetect = popen(command, "r"); + FILE *i2cdetect = popen("timeout 5 i2cdetect -y 1", "r"); // printf("1\n"); // pclose(i2cdetect); // printf("2\n"); // i2cdetect = popen("echo $?", "r"); - printf("getc i2cdetect output: %d\n", getc(i2cdetect)); +// printf("getc i2cdetect 1 output: %d\n", getc(i2cdetect)); int error = pclose(i2cdetect)/256; printf("%s error: %d \n", &command, error); - FILE *i2cdetect2 = popen(command, "r"); +// FILE *i2cdetect2 = popen(command, "r"); + FILE *i2cdetect2 = popen("timeout 5 i2cdetect -y 3", "r"); // printf("1\n"); - pclose(i2cdetect); +// pclose(i2cdetect); // printf("2\n"); - i2cdetect = popen("echo $?", "r"); - printf("getc echo output: %d\n", getc(i2cdetect)); +// i2cdetect = popen("echo $?", "r"); + // printf("getc echo output: %d\n", getc(i2cdetect)); error = pclose(i2cdetect2)/256; printf("%s error: %d \n", &command, error);