Quantcast
Channel: Active questions tagged linux-kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 12305

How are some Linux device drivers automatically loaded/unloaded?

$
0
0

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 via insmod
  • Open - the device is opened/readied for usage
  • Read/Write - the device is used
  • Close - the device is closed/disconnected, currently no longer useable (unless re-opened)
  • Release - the driver (now a kernel module) is unloaded from the kernel via rmmod

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)?


Viewing all articles
Browse latest Browse all 12305

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>