mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-07 12:19:31 +00:00
1 line
7.0 KiB
JSON
1 line
7.0 KiB
JSON
|
{"pageProps":{"metadata":{"date":"\"2020-09-09 05:27:17 +08:00\"","date_modified":"\"2021-05-04 20:51:26 +08:00\"","language":"en","source":""},"title":"Linux drivers","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Linux drivers (also called as kernel modules) are software executed in the kernel.\nUsually, they are used to communicate between hardware and create an inteface with it, making them usable.\nExamples include "},{"type":"element","tagName":"a","properties":{"href":"http://linuxwacom.sourceforge.net/"},"children":[{"type":"text","value":"the Linux Wacom project"}]},{"type":"text","value":" to make Wacom graphics tablet usable in Linux, those sort of stuff.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://www.youtube.com/watch?v=juGNPLdjLH4"},"children":[{"type":"text","value":"Liveoverflow's video summary"}]},{"type":"text","value":":\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"A driver is just a compiled module (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"driver.o"}]},{"type":"text","value":") that makes use of the code in the Linux header and does the communication from the associated device.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Each driver may have functions attached to an event (e.g., opening in "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"module_open"}]},{"type":"text","value":", closing in "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"module_exit"}]},{"type":"text","value":").\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can insert a driver with the "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"insmod"}]},{"type":"text","value":" program and remove it with the "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"rmmod"}]},{"type":"text","value":" program.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Each driver will appear on a special filesystem in "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"/dev"}]},{"type":"text","value":" as a special type of file which you can view what type of file it is with "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"ls -l"}]},{"type":"text","value":".\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can print out events (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"printk"}]},{"type":"text","value":") and view it in the system log (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"/var/log/syslog"}]},{"type":"text","value":").\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Essentially, a driver is basically a
|