aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/06/readme
blob: 62a7c6506a9bdf1743f9ab841be8133f702c713f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Task 06
=======

Nice job with the module loading macros, those are tricky, but a very
valuable skill to know about, especially when running across them in
real kernel code.

Speaking of real kernel code, let's write some!

The task this time is this:

  - Take the kernel module you wrote for task 01, and modify it to be a
    misc char device driver.  The misc interface is a very simple way to
    be able to create a character device, without having to worry about
    all of the sysfs and character device registration mess.  And what a
    mess it is, so stick to the simple interfaces wherever possible.

  - The misc device should be created with a dynamic minor number, no
    need running off and trying to reserve a real minor number for your
    test module, that would be crazy.

  - The misc device should implement the read and write functions.

  - The misc device node should show up in /dev/eudyptula.

  - When the character device node is read from, your assigned id is
    returned to the caller.

  - When the character device node is written to, the data sent to the
    kernel needs to be checked.  If it matches your assigned id, then
    return a correct write return value.  If the value does not match
    your assigned id, return the "invalid value" error value.

  - The misc device should be registered when your module is loaded, and
    unregistered when it is unloaded.

  - Provide some "proof" this all works properly.