From 83bbc1ec2416924141c116f9b1b930cacf018505 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 11 Sep 2020 18:08:30 -0400 Subject: [PATCH] added bus string determination --- afsk/telem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/afsk/telem.c b/afsk/telem.c index 3d930be5..8ce6ea42 100644 --- a/afsk/telem.c +++ b/afsk/telem.c @@ -247,15 +247,18 @@ int main(int argc, char *argv[]) { int test_i2c_bus(int bus) { int output = 1; - char *busString = "/dev/i2c-3"; + char *busDev = "/dev/i2c-"; + char *busString[25]; char *busS[5]; + sprintf(busS, "%d", bus); + strcat (busString, busDev); + strcat (busString, busS); + printf("Bus Dev String: %s \n", busString); if (access(busString, W_OK | R_OK) >= 0) { // Test if I2C Bus 0 is present // printf("bus is present\n\n"); char result[128]; char command[50] = "timeout 10 i2cdetect -y "; - sprintf(busS, "%d", bus); - printf("Bus String: %s \n", busS); strcat (command, busS); // printf("Command: %s \n", command); FILE *i2cdetect = popen(command, "r");