This commit is contained in:
@@ -75,8 +75,9 @@ static void doReadallExternal (void)
|
||||
*********************************************************************************
|
||||
*/
|
||||
|
||||
#define MAX_ALTS 11
|
||||
static const char unknown_alt[] = " - ";
|
||||
static const char *alts [] =
|
||||
static const char *alts [MAX_ALTS+1] =
|
||||
{
|
||||
"IN", "OUT", "ALT5", "ALT4", "ALT0", "ALT1", "ALT2", "ALT3", "ALT6", "ALT7", "ALT8", "ALT9"
|
||||
} ;
|
||||
@@ -84,7 +85,7 @@ static const char *alts [] =
|
||||
|
||||
static const char* GetAltString(int alt) {
|
||||
|
||||
if (alt>=0 && alt<=11) {
|
||||
if (alt>=0 && alt<=MAX_ALTS) {
|
||||
return alts[alt];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#define VERSION "3.9"
|
||||
#define VERSION "3.10"
|
||||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 9
|
||||
#define VERSION_MINOR 10
|
||||
|
||||
@@ -1671,14 +1671,14 @@ int OpenAndCheckGpioChip(int GPIONo, const char* label, const unsigned int lines
|
||||
return Fd;
|
||||
} else {
|
||||
if (wiringPiDebug) {
|
||||
printf ("wiringPi: Open chip %s succeded, fd=%d\n", szGPIOChip, Fd) ;
|
||||
printf("wiringPi: Open chip %s succeded, fd=%d\n", szGPIOChip, Fd) ;
|
||||
}
|
||||
struct gpiochip_info chipinfo;
|
||||
ZeroMemory(&chipinfo, sizeof(chipinfo));
|
||||
int ret = ioctl(Fd, GPIO_GET_CHIPINFO_IOCTL, &chipinfo);
|
||||
if (0==ret) {
|
||||
if (wiringPiDebug) {
|
||||
printf ("%s: name=%s, label=%s, lines=%u\n", szGPIOChip, chipinfo.name, chipinfo.label, chipinfo.lines) ;
|
||||
printf("%s: name=%s, label=%s, lines=%u\n", szGPIOChip, chipinfo.name, chipinfo.label, chipinfo.lines) ;
|
||||
}
|
||||
int chipOK = 1;
|
||||
if (label[0]!='\0' && NULL==strstr(chipinfo.label, label)) {
|
||||
@@ -1688,10 +1688,12 @@ int OpenAndCheckGpioChip(int GPIONo, const char* label, const unsigned int lines
|
||||
chipOK = 0;
|
||||
}
|
||||
if (chipOK) {
|
||||
printf ("%s: valid, fd=%d\n", szGPIOChip, Fd);
|
||||
if (wiringPiDebug) {
|
||||
printf("%s: valid, fd=%d\n", szGPIOChip, Fd);
|
||||
}
|
||||
} else {
|
||||
if (wiringPiDebug) {
|
||||
printf ("%s: invalid, search for '%s' with %u lines!\n", szGPIOChip, label, lines) ;
|
||||
printf("%s: invalid, search for '%s' with %u lines!\n", szGPIOChip, label, lines) ;
|
||||
}
|
||||
close(Fd);
|
||||
return -1; // invalid chip
|
||||
@@ -1710,7 +1712,7 @@ int wiringPiGpioDeviceGetFd() {
|
||||
chipFd = OpenAndCheckGpioChip(4, "rp1", 54); // /dev/gpiochip4 @ Pi5 with older kernel
|
||||
}
|
||||
} else {
|
||||
// not sure if all Pis have 54 lines (Pi1v1, Pi1v2 and CM ?), so this check is disabled
|
||||
// not all Pis have same number of lines: Pi0, Pi1, Pi3, 54 lines, Pi4, 58 lines (CM ?), see #280, so this check is disabled
|
||||
chipFd = OpenAndCheckGpioChip(0, "bcm", 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user