From the course: Linux Device Drivers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Write a character driver

Solution: Write a character driver - Linux Tutorial

From the course: Linux Device Drivers

Start my 1-month free trial

Solution: Write a character driver

(upbeat music) - [Instructor] So let's look at solutions for those challenges. The first question was, build and load the char driver from the exercise files. So you need to change the directory into exercises. Chapter three, dual make should try to use the header for your current Colonel, so that all needs to be installed. And then you should get chardriver1.ko, and as route with Sudo you insmod that, then number two, create a character device file with major 197 and minor zero. 'Cause that's what the driver expects. And I made it in tmp, and again, it got to be route, so Sudo, mknod, tmp/mydev, C for character 197 for the major, zero for the minor. Number three, echo your name into that. So if you look at the source code to char driver, you'll see there's a limited buffer, so don't try to Echo the dictionary into it or something, just your name there. And then step four, you cut it and that should show your name.…

Contents