kopia lustrzana https://github.com/Hamlib/Hamlib
Add missing breaks and improve error messages
rodzic
1bf736d650
commit
3ee7b68d42
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Ładowanie…
Reference in New Issue