wiringPi: Move moduleLoaded function to export
Change-Id: Ie74b852ebdd596bb3dfd7ec6ec37c7f050948195
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user