diff options
| author | Philip Balister <philip@opensdr.com> | 2010-08-28 19:54:03 -0400 | 
|---|---|---|
| committer | Philip Balister <philip@opensdr.com> | 2010-08-28 19:54:03 -0400 | 
| commit | ee44eecc3e2047b1514794add99203c4d2d3c7cc (patch) | |
| tree | a2819221ce2c70a9792bf550bf252d05ccb50b91 | |
| parent | a79d320d7691fea82c9194d59a5d4dc7bbb40317 (diff) | |
| download | uhd-ee44eecc3e2047b1514794add99203c4d2d3c7cc.tar.gz uhd-ee44eecc3e2047b1514794add99203c4d2d3c7cc.tar.bz2 uhd-ee44eecc3e2047b1514794add99203c4d2d3c7cc.zip | |
Test if usrp_e kernel module is loaded before trying to load the FPGA. Do
not load the the fpga if the kernel module is loaded.
| -rw-r--r-- | host/utils/fpga-downloader.cpp | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/host/utils/fpga-downloader.cpp b/host/utils/fpga-downloader.cpp index fb96b64a3..80ee71600 100644 --- a/host/utils/fpga-downloader.cpp +++ b/host/utils/fpga-downloader.cpp @@ -27,6 +27,7 @@  #include <cstdlib>  #include <fcntl.h> +#include <errno.h>  #include <sys/types.h>  #include <sys/stat.h>  #include <sys/ioctl.h> @@ -240,6 +241,21 @@ int main(int argc, char *argv[])  	if (argc == 2)  		bit_file = argv[1]; +	bool module_found(false); +	std::ifstream mod_file("/proc/modules"); +	while (!mod_file.eof()) { +		std::string line; +		getline(mod_file, line); +		if (line.find("usrp_e") != std::string::npos) +			module_found = true; +	} +	mod_file.close(); + +	if (module_found) { +		std::cout << "USRP Embedded kernel module loaded, not loading FPGA." << std::endl; +		return -1; +	} +  	std::cout << "FPGA config file: " << bit_file << std::endl;  	prepare_fpga_for_configuration(gpio_prog_b, gpio_init_b); | 
