From: Adam M. <mcl...@gm...> - 2007-02-07 17:06:26
|
On 2/7/07, Dave Hylands <dhy...@gm...> wrote: > So, as far as I know you don't have to do anything. When you say you > include module.h, do you mean from a usr mode app or from kernel side? I mean that the beginning of my C++ program has the line "#include <linux/module.h>" in it. > Attempting to load a module which isn't present just causes modprobe > to produce an error, it isn't fatal. I'm not running modprobe. I want to programatically check to see if the module is present at runtime. > Similarly, trying to open /dev/i2c-0 when the i2c-dev module isn't > loaded also just causes open to get an error, again it isn't fatal. Ah, but if my program does not take action in response to the module being missing, it will generate a fatal error. > If you are running into a fatal error of some type, perhaps you can > describe the error a bit better. My program uses a set of threads that depend on one another to function. One of these threads uses the I2C bus. If the modules aren't installed, I shouldn't create any of the set. I suppose I could run a test wherein I open and close the device, and use that as a substitute for just checking for the presence of the modules. However, if the modules are present and the device cannot be opened, then the program should rightly terminate with an error. So I figured the 'correct' way to write the program would involve both types of test. Adam |