From 3ee7b68d426a97f3a3b302b1d6afaef0e170e299 Mon Sep 17 00:00:00 2001 From: Jeroen Vreeken Date: Mon, 30 May 2016 14:12:01 +0200 Subject: [PATCH] Add missing breaks and improve error messages --- src/gpio.c | 9 ++++++--- src/rig.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gpio.c b/src/gpio.c index c69579d21..d787ab5fb 100644 --- a/src/gpio.c +++ b/src/gpio.c @@ -40,7 +40,8 @@ int gpio_open(hamlib_port_t *port, int on_value) snprintf(pathname, FILPATHLEN, "/sys/class/gpio/export"); fexp = fopen(pathname, "w"); if (!fexp) { - rig_debug(RIG_DEBUG_ERR, "Export GPIO \"%s\": %s\n", port->pathname, strerror(errno)); + rig_debug(RIG_DEBUG_ERR, "Export GPIO%s (using %s): %s\n", + port->pathname, pathname, strerror(errno)); return -RIG_EIO; } fprintf(fexp, "%s\n", port->pathname); @@ -49,7 +50,8 @@ int gpio_open(hamlib_port_t *port, int on_value) snprintf(pathname, FILPATHLEN, "/sys/class/gpio/gpio%s/direction", port->pathname); fdir = fopen(pathname, "w"); if (!fdir) { - rig_debug(RIG_DEBUG_ERR, "GPIO\"%s\" direction: %s\n", port->pathname, strerror(errno)); + rig_debug(RIG_DEBUG_ERR, "GPIO%s direction (using %s): %s\n", + port->pathname, pathname, strerror(errno)); return -RIG_EIO; } fprintf(fdir, "out\n"); @@ -58,7 +60,8 @@ int gpio_open(hamlib_port_t *port, int on_value) snprintf(pathname, FILPATHLEN, "/sys/class/gpio/gpio%s/value", port->pathname); fd = open(pathname, O_WRONLY); if (fd < 0) { - rig_debug(RIG_DEBUG_ERR, "GPIO\"%s\" opening value file %s: %s\n", port->pathname, pathname, strerror(errno)); + rig_debug(RIG_DEBUG_ERR, "GPIO%s opening value file %s: %s\n", + port->pathname, pathname, strerror(errno)); return -RIG_EIO; } diff --git a/src/rig.c b/src/rig.c index 9f0add53d..279e1b08e 100644 --- a/src/rig.c +++ b/src/rig.c @@ -590,6 +590,7 @@ int HAMLIB_API rig_open(RIG *rig) status = -RIG_EIO; } else gpio_ptt_set(&rs->pttport, RIG_PTT_OFF); + break; case RIG_PTT_GPION: rs->pttport.fd = gpio_open(&rs->pttport, 0); if (rs->pttport.fd < 0) { @@ -599,6 +600,7 @@ int HAMLIB_API rig_open(RIG *rig) status = -RIG_EIO; } else gpio_ptt_set(&rs->pttport, RIG_PTT_OFF); + break; default: rig_debug(RIG_DEBUG_ERR, "Unsupported PTT type %d\n", rs->pttport.type.ptt);