wiringPi: Move moduleLoaded function to export

Change-Id: Ie74b852ebdd596bb3dfd7ec6ec37c7f050948195
This commit is contained in:
Joshua Yang
2018-05-10 13:43:52 +09:00
parent 180614e619
commit 66663ae72a
3 changed files with 31 additions and 32 deletions

View File

@@ -161,38 +161,6 @@ static void changeOwner (char *cmd, char *file)
}
}
/*
* moduleLoaded:
* Return true/false if the supplied module is loaded
*********************************************************************************
*/
static int moduleLoaded (char *modName)
{
int len = strlen (modName) ;
int found = FALSE ;
FILE *fd = fopen ("/proc/modules", "r") ;
char line [80] ;
if (fd == NULL) {
fprintf (stderr, "gpio: Unable to check /proc/modules: %s\n",
strerror (errno)) ;
exit (1) ;
}
while (fgets (line, 80, fd) != NULL) {
if (strncmp (line, modName, len) != 0)
continue ;
found = TRUE ;
break ;
}
fclose (fd) ;
return found ;
}
/*
* doLoad:
* Load either the spi or i2c modules and change device ownerships, etc.