With regards to Linux device drivers, my understanding (obtained from reading this excellent DIY article) is that there are essentially six events/parts of a device driver "lifecycle":
Load- the compiled driver is loaded as a Linux kernel module viainsmodOpen- the device is opened/readied for usageRead/Write- the device is usedClose- the device is closed/disconnected, currently no longer useable (unless re-opened)Release- the driver (now a kernel module) is unloaded from the kernel viarmmod
Thanks to that article and countless others, I can now write a whole bunch of C code to implement hooks/callbacks for what should happen when the kernel issues Open, Read, Write and Close commands. But, it seems that the driver must be loaded/released manually by issuing an insmod (load) and rmmod (release) at the shell.
However, I know this can't be the case because certain devices, like USB, allow you to connect/disconnect them dynamically/on-the-fly, and their respective drivers must be automatically loaded/released on-the-fly as well.
So this stirs up the following question: How do certain technologies, like USB, automate the execution of insmod and rmmod (hence the dynamic loading/releasing of USB device drivers)?
hotplugand that its respective library,libudevis what I would need to code against for hotplugging device drivers? Thanks again! - smeeb