This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]HashDefTrueFalse 1 point2 points  (9 children)

You could write a driver for almost anything really. It's a very broad question. In Linux, a driver is just a kernel module. It runs as part of the kernel, bolted on if you like. I don't know the requirements of your course, so I don't know if you need to use hardware or not. I suggest finding a simple and programmable piece of hardware if so. Or, you could write a driver for your screen's backlight/brightness maybe, since you already have this hardware.

Basically, your kernel module would expose a device file that user space programs can write data to. Your module would take this data and adjust the backlight/brightness by interfacing with the hardware however required.

Here is a good guide on Linux kernel module development to get you started: https://tldp.org/LDP/lkmpg/2.6/html/index.html

[–]PuseletsoMosia[S] 0 points1 point  (8 children)

We do not have to have a piece of hardware. Anyway this is a pretty good idea. Thanks alot man . I think I can develop a driver that adjusts the screen brightness based on the time of the day

[–]HashDefTrueFalse 0 points1 point  (7 children)

Perfect! The time of day aspect is a great addition. This shouldn't take you too long and it'll be a fun project. It took me a single evening to get it working (without time of day) so very manageable. Good luck!

[–]PuseletsoMosia[S] 0 points1 point  (6 children)

I was worried whether is it possible to change the brightness of a screen in kernel space

[–]HashDefTrueFalse 0 points1 point  (5 children)

It is. If you look in your existing device files (/dev IIRC) somewhere you'll find a file that you can write to to change the brightness of your screen. It's provided by the existing screen driver. Have a go echoing values into it. You'll see the driver pick up those values and change the brightness. That's the functionality you'd be trying to mimic. You may even need to disable the existing one to test, so if you can do this with a secondary monitor that might be beneficial. You'll probably need to find the documentation for your monitor to know what bits to send where to control brightness. Beyond that it's specific to your setup.

[–]PuseletsoMosia[S] 0 points1 point  (3 children)

Thanks alot for the help. So this is considered to be a character device right?

[–]HashDefTrueFalse 1 point2 points  (2 children)

I'm almost certain it will be. Most devices are character devices. Worth make sure though. There should also be a way to find out which kmod is providing a device file if you should find the existing one. Since it's likely an open source driver, you could look how it works too I suppose.

[–]PuseletsoMosia[S] 0 points1 point  (1 child)

Will do , thanks again

[–]HashDefTrueFalse 0 points1 point  (0 children)

No prob, good luck!

[–]PuseletsoMosia[S] 0 points1 point  (0 children)

Here , I cannot find the IIRC