1
0
mirror of https://github.com/xtacocorex/CHIP_IO synced 2025-07-20 04:43:21 +00:00

Fixing issue where using alt name for the XIO would cause a segfault when speficying the pin as an input. This will close #62

This commit is contained in:
Robert Wolterman
2017-03-06 17:08:05 -06:00
parent dcd8ea6f40
commit 4da0812acd
7 changed files with 19 additions and 8 deletions

View File

@ -263,7 +263,7 @@ int gpio_allowed(int gpio)
// We have a CHIP and the pin is for CHIP/BOTH
if (((p->sbc_type == CHIP) || (p->sbc_type == BOTH)) && (is_this_chippro() == 0)) {
if (DEBUG)
printf(" ** gpio_allowed: pin allowed for chip or bth and we're a chip\n");
printf(" ** gpio_allowed: pin allowed for chip or both and we're a chip\n");
rtnval = 1;
// We have a CHIP Pro and the pin is for CHIPPRO/BOTH
} else if (((p->sbc_type == CHIPPRO) || (p->sbc_type == BOTH)) && (is_this_chippro() == 1)) {
@ -296,7 +296,7 @@ int pwm_allowed(const char *key)
// We have a CHIP and the pin is for CHIP/BOTH
if ((p->sbc_type == BOTH) && (is_this_chippro() == 0)) {
if (DEBUG)
printf(" ** pwm_allowed: pwm allowed for chip or bth and we're a chip\n");
printf(" ** pwm_allowed: pwm allowed for chip or both and we're a chip\n");
rtnval = 1;
// We have a CHIP Pro and the pin is for CHIPPRO/BOTH
} else if (((p->sbc_type == CHIPPRO) || (p->sbc_type == BOTH)) && (is_this_chippro() == 1)) {
@ -554,7 +554,7 @@ int compute_port_pin(const char *key, int gpio, int *port, int *pin)
if (capable < 0) {
capable = lookup_pud_capable_by_name(key);
if (capable < 0) {
capable = lookup_gpio_by_altname(key);
capable = lookup_pud_capable_by_altname(key);
if (capable < 0) {
capable = 0; // default to false
}