Skip to content

Commit 901f67b

Browse files
committed
Fix inaccurate chardev.c documentation
This commit clarifies that /proc/devices shows registered devices and major numbers, not the device file content. It also corrects the actual device path to /dev/chardev for reading. Close #337
1 parent 5586d5b commit 901f67b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lkmpg.tex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,14 +1121,16 @@ \subsection{Unregistering A Device}
11211121
\subsection{chardev.c}
11221122
\label{sec:chardev_c}
11231123
The next code sample creates a char driver named \verb|chardev|.
1124-
You can dump its device file.
1124+
You can verify it has been registered by checking:
11251125

11261126
\begin{codebash}
11271127
cat /proc/devices
11281128
\end{codebash}
11291129

1130-
(or open the file with a program) and the driver will put the number of times the device file has been read from into the file.
1131-
We do not support writing to the file (like \sh|echo "hi" > /dev/hello|), but catch these attempts and tell the user that the operation is not supported.
1130+
This will show the device's major number.
1131+
To actually use the device, you need to read from \verb|/dev/chardev| (or open the file with a program) and the driver will put the number of times the device file has been read from into the file.
1132+
We do not support writing to the file (like \sh|echo "hi" > /dev/chardev|),
1133+
but catch these attempts and tell the user that the operation is not supported.
11321134
Do not worry if you do not see what we do with the data we read into the buffer; we do not do much with it.
11331135
We simply read in the data and print a message acknowledging that we received it.
11341136

0 commit comments

Comments
 (0)