You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if ((pin<0) || (pin>63))
returnwiringPiFailure (WPI_FATAL, "wiringPiISR: pin must be 0-63 (%d)\n", pin) ;
/**/if (wiringPiMode==WPI_MODE_UNINITIALISED)
returnwiringPiFailure (WPI_FATAL, "wiringPiISR: wiringPi has not been initialised. Unable to continue.\n") ;
elseif (wiringPiMode==WPI_MODE_PINS)
bcmGpioPin=pinToGpio [pin] ;
elseif (wiringPiMode==WPI_MODE_PHYS)
bcmGpioPin=physToGpio [pin] ;
elsebcmGpioPin=pin ;
// Now export the pin and set the right edge// We're going to use the gpio program to do this, so it assumes// a full installation of wiringPi. It's a bit 'clunky', but it// is a way that will work when we're running in "Sys" mode, as// a non-root user. (without sudo)if (mode!=INT_EDGE_SETUP)
{
/**/if (mode==INT_EDGE_FALLING)
modeS="falling" ;
elseif (mode==INT_EDGE_RISING)
modeS="rising" ;
elsemodeS="both" ;
sprintf (pinS, "%d", pin) ;
if ((pid=fork ()) <0) // FailreturnwiringPiFailure (WPI_FATAL, "wiringPiISR: fork failed: %s\n", strerror (errno)) ;
if (pid==0) // Child, exec
{
/**/if (access ("/usr/local/bin/gpio", X_OK) ==0)
{
execl ("/usr/local/bin/gpio", "gpio", "edge", pinS, modeS, (char*)NULL) ;
returnwiringPiFailure (WPI_FATAL, "wiringPiISR: execl failed: %s\n", strerror (errno)) ;
}
elseif (access ("/usr/bin/gpio", X_OK) ==0)
{
execl ("/usr/bin/gpio", "gpio", "edge", pinS, modeS, (char*)NULL) ;
returnwiringPiFailure (WPI_FATAL, "wiringPiISR: execl failed: %s\n", strerror (errno)) ;
}
elsereturnwiringPiFailure (WPI_FATAL, "wiringPiISR: Can't find gpio program\n") ;
}
else// Parent, waitwait (NULL) ;
}
wiringPi.c文件的第4535行sprintf (pinS, "%d", pin) ;应该改为sprintf (pinS, "%d", bcmGpioPin ) ;,否则会报错:“gpio: Unable to open GPIO direction interface for pin XX: No such file or directory”
bug附近的代码
wiringPi.c文件的第4535行
sprintf (pinS, "%d", pin) ;
应该改为sprintf (pinS, "%d", bcmGpioPin ) ;
,否则会报错:“gpio: Unable to open GPIO direction interface for pin XX: No such file or directory”我检查了gpio.c文件,根据上面的代码,跟edge有关的部分,使用的管脚编号应该是GPIO编号,而不是输入到wiringPiISR函数的pin
The text was updated successfully, but these errors were encountered: