Skip to Main Content
Understanding the Linux Kernel
book

Understanding the Linux Kernel

by Daniel P. Bovet, Marco Cesati
October 2000
Intermediate to advanced content levelIntermediate to advanced
704 pages
18h 13m
English
O'Reilly Media, Inc.
Content preview from Understanding the Linux Kernel

13.4. Character Device Handling

Handling a character device is relatively easy, since no data buffering is needed and no disk caches are involved. Of course, character devices differ in their requirements: some of them must implement a sophisticated communication protocol to drive the hardware device, while others just have to read a few values from a couple of I/O ports of the hardware devices. For instance, the device driver of a multiport serial card device (a hardware device offering many serial ports) is much more complicated than the device driver of a bus mouse.

Let's briefly sketch out the functioning of a very simple character device driver, namely the driver of the Logitech bus mouse. It is associated with the /dev/logibm character device file, which has major number 10 and minor number 0.

Suppose that a process opens the /dev/logibm file; as explained in Section 13.2.2 earlier in this chapter, the VFS ends up invoking the open method of the device file operations common to all character devices having major number 10. This device class covers a series of heterogeneous devices, and hence the method, a function called misc_open( ), installs yet a more specialized set of file operations according to the device's minor number. As the final result, the field f_op of the file object points to the bus_mouse_fops table, and the open_mouse( ) function is invoked. This function performs the following operations:

  1. Checks whether the bus mouse is connected.

  2. Requests the IRQ line ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Kernel in a Nutshell

Linux Kernel in a Nutshell

Greg Kroah-Hartman
Linux Kernel Debugging

Linux Kernel Debugging

Kaiwan N. Billimoria
Understanding the Linux Kernel, 3rd Edition

Understanding the Linux Kernel, 3rd Edition

Daniel P. Bovet, Marco Cesati

Publisher Resources

ISBN: 0596000022Catalog PageErrata