diff --git a/gpio_sysfs.c b/gpio_sysfs.c index 48b4449..1b0ac4c 100644 --- a/gpio_sysfs.c +++ b/gpio_sysfs.c @@ -89,12 +89,12 @@ int gpio_direction(int pin, int dir) snprintf(path, DIRECTION_MAX, "/sys/class/gpio/gpio%d/direction", pin); fd = open(path, O_WRONLY); if (-1 == fd) { - fprintf(stderr, "Failed to open gpio direction for writing!\n"); + fprintf(stderr, "Failed to open gpio%d direction for writing!\n", pin); return(-1); } if (-1 == write(fd, &s_directions_str[IN == dir ? 0 : 3], IN == dir ? 2 : 3)) { - fprintf(stderr, "Failed to set direction!\n"); + fprintf(stderr, "Failed to set gpio%d direction!\n", pin); return(-1); } @@ -117,12 +117,12 @@ int gpio_read(int pin) snprintf(path, VALUE_MAX, "/sys/class/gpio/gpio%d/value", pin); fd = open(path, O_RDONLY); if (-1 == fd) { - fprintf(stderr, "Failed to open gpio value for reading!\n"); + fprintf(stderr, "Failed to open gpio%d for reading!\n", pin); return(-1); } if (-1 == read(fd, value_str, 3)) { - fprintf(stderr, "Failed to read value!\n"); + fprintf(stderr, "Failed to read gpio%d!\n", pin); return(-1); } @@ -146,12 +146,12 @@ int gpio_write(int pin, int value) snprintf(path, VALUE_MAX, "/sys/class/gpio/gpio%d/value", pin); fd = open(path, O_WRONLY); if (-1 == fd) { - fprintf(stderr, "Failed to open gpio value for writing!\n"); + fprintf(stderr, "Failed to open gpio% for writing!\n"); return(-1); } if (1 != write(fd, &s_values_str[LOW == value ? 0 : 1], 1)) { - fprintf(stderr, "Failed to write value!\n"); + fprintf(stderr, "Failed to write gpio%d!\n", pin); return(-1); }