You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: lkmpg.tex
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1121,14 +1121,16 @@ \subsection{Unregistering A Device}
1121
1121
\subsection{chardev.c}
1122
1122
\label{sec:chardev_c}
1123
1123
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:
1125
1125
1126
1126
\begin{codebash}
1127
1127
cat /proc/devices
1128
1128
\end{codebash}
1129
1129
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.
1132
1134
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.
1133
1135
We simply read in the data and print a message acknowledging that we received it.
0 commit comments