diff --git a/gpio/gpio_odroid.c b/gpio/gpio_odroid.c index 4616f80..8973bb6 100755 --- a/gpio/gpio_odroid.c +++ b/gpio/gpio_odroid.c @@ -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. diff --git a/wiringPi/wiringOdroid.c b/wiringPi/wiringOdroid.c index 7b2955f..738479c 100755 --- a/wiringPi/wiringOdroid.c +++ b/wiringPi/wiringOdroid.c @@ -115,6 +115,36 @@ int wiringPiReturnCodes = FALSE ; // ODROID Wiring Library struct libodroid libwiring; +/*----------------------------------------------------------------------------*/ +// +// Return true/false if the supplied module is loaded +// +/*----------------------------------------------------------------------------*/ +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 ; +} + /*----------------------------------------------------------------------------*/ // // ODROID System Message function diff --git a/wiringPi/wiringOdroid.h b/wiringPi/wiringOdroid.h index ef1ca09..d6df8d1 100755 --- a/wiringPi/wiringOdroid.h +++ b/wiringPi/wiringOdroid.h @@ -89,6 +89,7 @@ extern "C" { // Export function define /*----------------------------------------------------------------------------*/ extern int msg (int type, const char *message, ...); +extern int moduleLoaded(char *); #ifdef __cplusplus }