mraa.c: Moved iio detection code into a function