* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "libsigrok.h"
-#include "libsigrok-internal.h"
-#include "gpio.h"
+#include <config.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
+#include <libsigrok/libsigrok.h>
+#include "libsigrok-internal.h"
+#include "gpio.h"
#define LOG_PREFIX "gpio"
fd = g_fopen(path, "w");
if (!fd) {
- sr_err("error opening %s: %s", path, strerror(errno));
+ sr_err("Error opening %s: %s", path, g_strerror(errno));
return -1;
}
wr = g_fprintf(fd, "%s", buf);
fclose(fd);
if (wr < 0) {
- sr_err("error writing to %s: %s", path, strerror(errno));
+ sr_err("Error writing to %s: %s", path, g_strerror(errno));
return -1;
}
g_string_printf(path, "/sys/class/gpio/gpio%d/value", gpio);
fd = g_fopen(path->str, "r");
if (!fd) {
- sr_err("error opening %s: %s", path->str, strerror(errno));
+ sr_err("Error opening %s: %s", path->str, g_strerror(errno));
g_string_free(path, TRUE);
return -1;
}
status = fscanf(fd, "%d", &ret);
fclose(fd);
if (status != 1) {
- sr_err("error reading from %s: %s", path, strerror(errno));
+ sr_err("Error reading from %s: %s", path->str, g_strerror(errno));
g_string_free(path, TRUE);
return -1;
}