In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, a device driver is a
computer program
A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components.
A computer progra ...
that operates or controls a particular type of
device
A device is usually a constructed tool. Device may also refer to:
Technology Computing
* Device, a colloquial term encompassing desktops, laptops, tablets, smartphones, etc.
* Device file, an interface of a device driver
* Peripheral, any devi ...
that is attached to a
computer or
automaton
An automaton (; plural: automata or automatons) is a relatively self-operating machine, or control mechanism designed to automatically follow a sequence of operations, or respond to predetermined instructions.Automaton – Definition and More ...
.
A driver provides a software
interface to
hardware devices, enabling
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s and other computer programs to access hardware functions without needing to know precise details about the hardware being used.
A driver communicates with the device through the
computer bus or communications subsystem to which the hardware connects. When a
calling program invokes a
routine in the driver, the driver issues commands to the device (drives it). Once the device sends data back to the driver, the driver may invoke routines in the original calling program.
Drivers are hardware dependent and operating-system-specific. They usually provide the
interrupt
In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted ...
handling required for any necessary asynchronous time-dependent hardware interface.
Purpose
The main purpose of device drivers is to provide abstraction by acting as a translator between a hardware device and the applications or
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s that use it.
Programmers can write higher-level application code independently of whatever specific hardware the end-user is using.
For example, a high-level application for interacting with a
serial port
In computing, a serial port is a serial communication interface through which information transfers in or out sequentially one bit at a time. This is in contrast to a parallel port, which communicates multiple bits simultaneously in paralle ...
may simply have two functions for "send data" and "receive data". At a lower level, a device driver implementing these functions would communicate to the particular serial port controller installed on a user's computer. The commands needed to control a
16550 UART
The 16550 UART (universal asynchronous receiver/transmitter) is an integrated circuit designed for implementing the interface for serial communications. The corrected -A version was released in 1987 by National Semiconductor. It is frequently u ...
are much different from the commands needed to control an
FTDI serial port converter, but each hardware-specific device driver
abstracts these details into the same (or similar) software interface.
Development
Writing a device driver requires an in-depth understanding of how the hardware and the software works for a given
platform
Platform may refer to:
Technology
* Computing platform, a framework on which applications may be run
* Platform game, a genre of video games
* Car platform, a set of components shared by several vehicle models
* Weapons platform, a system ...
function. Because drivers require low-level access to hardware functions in order to operate, drivers typically operate in a highly
privilege
Privilege may refer to:
Arts and entertainment
* ''Privilege'' (film), a 1967 film directed by Peter Watkins
* ''Privilege'' (Ivor Cutler album), 1983
* ''Privilege'' (Television Personalities album), 1990
* ''Privilege (Abridged)'', an alb ...
d environment and can cause system operational issues if something goes wrong. In contrast, most user-level software on modern
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s can be stopped without greatly affecting the rest of the system. Even drivers executing in
user mode can crash a system if the device is
erroneously programmed. These factors make it more difficult and dangerous to diagnose problems.
The task of writing drivers thus usually falls to
software engineers or
computer engineers who work for hardware-development companies. This is because they have better information than most outsiders about the design of their hardware. Moreover, it was traditionally considered in the hardware
manufacturer's interest to guarantee that their clients can use their hardware in an optimum way. Typically, the
Logical Device Driver (LDD) is written by the operating system vendor, while the
Physical Device Driver (PDD) is implemented by the device vendor. However, in recent years, non-vendors have written numerous device drivers for proprietary devices, mainly for use with
free and open source operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s. In such cases, it is important that the hardware manufacturer provide information on how the device communicates. Although this information can instead be learned by
reverse engineering
Reverse engineering (also known as backwards engineering or back engineering) is a process or method through which one attempts to understand through deductive reasoning how a previously made device, process, system, or piece of software accompli ...
, this is much more difficult with hardware than it is with software.
Microsoft
Microsoft Corporation is an American multinational corporation, multinational technology company, technology corporation producing Software, computer software, consumer electronics, personal computers, and related services headquartered at th ...
has attempted to reduce system instability due to poorly written device drivers by creating a new framework for driver development, called
Windows Driver Frameworks (WDF). This includes
User-Mode Driver Framework (UMDF) that encourages development of certain types of drivers—primarily those that implement a
message-based protocol for communicating with their devices—as user-mode drivers. If such drivers malfunction, they do not cause system instability. The
Kernel-Mode Driver Framework (KMDF) model continues to allow development of kernel-mode device drivers, but attempts to provide standard implementations of functions that are known to cause problems, including cancellation of I/O operations, power management, and plug and play device support.
Apple
An apple is an edible fruit produced by an apple tree (''Malus domestica''). Apple trees are cultivated worldwide and are the most widely grown species in the genus '' Malus''. The tree originated in Central Asia, where its wild ances ...
has an open-source framework for developing drivers on
macOS
macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac (computer), Mac computers. Within the market of ...
, called I/O Kit.
In
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
environments, programmers can build device drivers as parts of the
kernel
Kernel may refer to:
Computing
* Kernel (operating system), the central component of most operating systems
* Kernel (image processing), a matrix used for image convolution
* Compute kernel, in GPGPU programming
* Kernel method, in machine lea ...
, separately as loadable
modules, or as user-mode drivers (for certain types of devices where kernel interfaces exist, such as for USB devices).
Makedev
In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files al ...
includes a list of the devices in Linux, including ttyS (terminal), lp (
parallel port), hd (disk), loop, and sound (these include
mixer,
sequencer,
dsp, and audio).
Microsoft Windows .sys
.sys is a filename extension used in MS-DOS applications and Microsoft Windows operating systems. They are system files that contain device drivers or hardware configurations for the system.
Most DOS files are real mode device drivers. Certain ...
files and
Linux
Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
.ko files can contain loadable device drivers. The advantage of loadable device drivers is that they can be loaded only when necessary and then unloaded, thus saving kernel memory.
Kernel mode vs. user mode
Device drivers, particularly on
Microsoft Windows platforms, can run in
kernel-mode (
Ring 0 on x86 CPUs) or in
user-mode (Ring 3 on x86 CPUs). The primary benefit of running a driver in user mode is improved stability, since a poorly written user-mode device driver cannot crash the system by overwriting kernel memory. On the other hand, user/kernel-mode transitions usually impose a considerable performance overhead, thus making kernel-mode drivers preferred for low-latency networking.
Kernel space can be accessed by user module only through the use of system calls. End user programs like the UNIX shell or other GUI-based applications are part of user space. These applications interact with hardware through kernel supported functions.
Applications
Because of the diversity of hardware and operating systems, drivers operate in many different environments. Drivers may
interface with:
*
Printers
*
Video adapters
A graphics card (also called a video card, display card, graphics adapter, VGA card/VGA, video adapter, display adapter, or mistakenly GPU) is an expansion card which generates a feed of output images to a display device, such as a computer moni ...
*
Network cards
*
Sound cards
* Local
buses of various sorts—in particular, for
bus mastering on modern systems
* Low-
bandwidth I/O buses of various sorts (for
pointing devices such as
mice,
keyboards, etc.)
*
Computer storage
Computer data storage is a technology consisting of computer components and recording media that are used to retain digital data. It is a core function and fundamental component of computers.
The central processing unit (CPU) of a comput ...
devices such as
hard disk,
CD-ROM, and
floppy disk
A floppy disk or floppy diskette (casually referred to as a floppy, or a diskette) is an obsolescent type of disk storage composed of a thin and flexible disk of a magnetic storage medium in a square or nearly square plastic enclosure lined ...
buses (
ATA,
SATA
SATA (Serial AT Attachment) is a computer bus interface that connects host adapter, host bus adapters to mass storage devices such as hard disk drives, optical drives, and solid-state drives. Serial ATA succeeded the earlier Parallel ATA (PATA) ...
,
SCSI,
SAS
SAS or Sas may refer to:
Arts, entertainment, and media
* ''SAS'' (novel series), a French book series by Gérard de Villiers
* ''Shimmer and Shine'', an American animated children's television series
* Southern All Stars, a Japanese rock ba ...
)
* Implementing support for different
file system
In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one lar ...
s
*
Image scanner
An image scanner—often abbreviated to just scanner—is a device that optically scans images, printed text, handwriting or an object and converts it to a digital image. Commonly used in offices are variations of the desktop ''flatbed scanner'' ...
s
*
Digital camera
A digital camera is a camera that captures photographs in digital memory. Most cameras produced today are digital, largely replacing those that capture images on photographic film. Digital cameras are now widely incorporated into mobile devic ...
s
*
Digital terrestrial television tuners
* Radio frequency communication transceiver adapters for
wireless personal area networks as used for short-distance and low-rate wireless communication in home automation, (such as example
Bluetooth Low Energy (BLE),
Thread
Thread may refer to:
Objects
* Thread (yarn), a kind of thin yarn used for sewing
** Thread (unit of measurement), a cotton yarn measure
* Screw thread, a helical ridge on a cylindrical fastener
Arts and entertainment
* ''Thread'' (film), 2016 ...
,
ZigBee
Zigbee is an IEEE 802.15.4-based specification for a suite of high-level communication protocols used to create personal area networks with small, low-power digital radios, such as for home automation, medical device data collection, and ...
, and
Z-Wave).
*
IrDA adapters
Common levels of abstraction for device drivers include:
* For hardware:
** Interfacing directly
** Writing to or reading from a
device control register In computing, a device control register is a hardware register that controls some computer hardware device, for example a peripheral or an expansion card.
Specific technologies use this terminology with a narrower meaning:
* The ISA PNP specificat ...
** Using some higher-level interface (e.g.
Video BIOS)
** Using another lower-level device driver (e.g. file system drivers using disk drivers)
** Simulating work with hardware, while doing something entirely different
* For software:
** Allowing the operating system direct access to hardware resources
** Implementing only
primitive
Primitive may refer to:
Mathematics
* Primitive element (field theory)
* Primitive element (finite field)
* Primitive cell (crystallography)
* Primitive notion, axiomatic systems
* Primitive polynomial (disambiguation), one of two concepts
* Pr ...
s
** Implementing an interface for non-driver software (e.g.
TWAIN)
** Implementing a language, sometimes quite high-level (e.g.
PostScript
PostScript (PS) is a page description language in the electronic publishing and desktop publishing realm. It is a dynamically typed, concatenative programming language. It was created at Adobe Systems by John Warnock, Charles Geschke, ...
)
So choosing and installing the correct device drivers for given hardware is often a key component of computer system configuration.
Virtual device drivers
Virtual device drivers represent a particular variant of device drivers. They are used to emulate a hardware device, particularly in
virtualization
In computing, virtualization or virtualisation (sometimes abbreviated v12n, a numeronym) is the act of creating a virtual (rather than actual) version of something at the same abstraction level, including virtual computer hardware platforms, st ...
environments, for example when a
DOS program is run on a
Microsoft Windows computer or when a guest
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
is run on, for example, a
Xen host. Instead of enabling the guest operating system to dialog with hardware, virtual device drivers take the opposite role and emulates a piece of hardware, so that the guest operating system and its drivers running inside a
virtual machine
In computing, a virtual machine (VM) is the virtualization/ emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Their implementations may involve specialized har ...
can have the illusion of accessing real hardware. Attempts by the guest operating system to access the hardware are routed to the virtual device driver in the host operating system as e.g.,
function calls. The virtual device driver can also send simulated processor-level events like
interrupt
In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted ...
s into the virtual machine.
Virtual devices may also operate in a non-virtualized environment. For example, a virtual
network adapter
A network interface controller (NIC, also known as a network interface card, network adapter, LAN adapter or physical network interface, and by similar terms) is a computer hardware component that connects a computer to a computer network.
E ...
is used with a
virtual private network, while a virtual
disk device is used with
iSCSI
Internet Small Computer Systems Interface or iSCSI ( ) is an Internet Protocol-based storage networking standard for linking data storage facilities. iSCSI provides block-level access to storage devices by carrying SCSI commands over a TCP/I ...
. A good example for virtual device drivers can be
Daemon Tools.
There are several variants of virtual device drivers, such as
VxDs,
VLMs, and VDDs.
Open source drivers
*
Graphics device driver
* Printers:
CUPS
* RAIDs: CCISS (Compaq Command Interface for SCSI-3 Support)
* Scanners:
SANE
* Video:
Vidix,
Direct Rendering Infrastructure
Solaris descriptions of commonly used device drivers:
* fas: Fast/wide SCSI controller
* hme: Fast (10/100 Mbit/s) Ethernet
* isp: Differential SCSI controllers and the SunSwift card
* glm: (Gigabaud Link Module) UltraSCSI controllers
* scsi: Small Computer Serial Interface (SCSI) devices
* sf: soc+ or social Fiber Channel Arbitrated Loop (FCAL)
* soc: SPARC Storage Array (SSA) controllers and the control device
* social: Serial optical controllers for FCAL (soc+)
APIs
*
Windows Display Driver Model (WDDM) – the graphic display driver architecture for
Windows Vista
Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, which was released five years before, at the time being the longest time span between successive releases of ...
and later.
* Unified Audio Model (UAM)
*
Windows Driver Foundation (WDF)
* Declarative Componentized Hardware (DCH) -
Universal Windows Platform driver
*
Windows Driver Model (WDM)
*
Network Driver Interface Specification (NDIS) – a standard
network card driver API
*
Advanced Linux Sound Architecture (ALSA) – the standard Linux sound-driver interface
*
Scanner Access Now Easy (SANE) – a public-domain interface to raster-image scanner-hardware
*
Installable File System (IFS) – a
filesystem API for IBM OS/2 and Microsoft Windows NT
*
Open Data-Link Interface
The Open Data-Link Interface (ODI), developed by Apple and Novell, serves the same function as Microsoft and 3COM's Network Driver Interface Specification (NDIS). Originally, ODI was written for NetWare and Macintosh environments. Like NDIS, OD ...
(ODI) – network card API similar to NDIS
*
Uniform Driver Interface The Uniform Driver Interface (UDI) is a defunct project developed by several companies to define a portable interface for device drivers.
The Uniform Driver Interface (UDI) allowed device drivers to be portable across both hardware platforms and op ...
(UDI) – a cross-platform driver interface project
* Dynax Driver Framework (dxd) – C++ open source cross-platform driver framework for KMDF and IOKit
Identifiers
A device on the
PCI bus or USB is identified by two IDs which consist of 4
hexadecimal
In mathematics and computing, the hexadecimal (also base-16 or simply hex) numeral system is a positional numeral system that represents numbers using a radix (base) of 16. Unlike the decimal system representing numbers using 10 symbols, h ...
numbers each. The vendor ID identifies the vendor of the device. The device ID identifies a specific device from that manufacturer/vendor.
A PCI device has often an ID pair for the main chip of the device, and also a subsystem ID pair which identifies the vendor, which may be different from the chip manufacturer.
Security
Devices often have a large number of diverse and customized device drivers running in their operating system (OS) kernel and often contain various
bugs
Bugs may refer to:
* Plural of bug
Arts, entertainment and media Fictional characters
* Bugs Bunny, a character
* Bugs Meany, a character in the ''Encyclopedia Brown'' books
Films
* ''Bugs'' (2003 film), a science-fiction-horror film
* ''Bugs ...
and
vulnerabilities, making them a target for
exploits. ''Bring Your Own Vulnerable Driver'' (BYOVD) uses signed, old drivers that contain flaws that allow hackers to insert malicious code into the kernel.
There is a lack of effective kernel vulnerability detection tools, especially for closed-source OSes such as Microsoft Windows where the source code of the device drivers is mostly not public (open source) and the drivers often also have many privileges.
Such vulnerabilities also exist in drivers in laptops, drivers for WiFi and bluetooth, gaming/graphics drivers, and drivers in printers.
A group of security researchers considers the lack of isolation as one of the
main factors undermining
kernel security, and published a
isolation framework to protect operating system kernels, primarily the
monolithic
A monolith is a monument or natural feature consisting of a single massive stone or rock.
Monolith or monolithic may also refer to:
Architecture
* Monolithic architecture, a style of construction in which a building is carved, cast or excavated ...
Linux kernel
The Linux kernel is a free and open-source, monolithic, modular, multitasking, Unix-like operating system kernel. It was originally authored in 1991 by Linus Torvalds for his i386-based PC, and it was soon adopted as the kernel for the GNU ...
which, according to them, gets ~80,000
commits/year to its drivers.
See also
*
Driver (software)
*
Class driver
*
Device driver synthesis and verification
Device drivers are programs which allow software or higher-level computer programs to interact with a hardware device. These software components act as a link between the devices and the operating systems, communicating with each of these system ...
*
Driver wrapper
*
Free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, ...
*
Firmware
In computing, firmware is a specific class of computer software that provides the low-level control for a device's specific hardware. Firmware, such as the BIOS of a personal computer, may contain basic functions of a device, and may provide ...
*
Loadable kernel module
In computing, a loadable kernel module (LKM) is an object file that contains code to extend the running kernel, or so-called ''base kernel'', of an operating system. LKMs are typically used to add support for new hardware (as device drivers) and ...
*
Makedev
In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files al ...
*
Microcontroller
*
Open-source hardware
*
Printer driver
*
Replicant (operating system)
*
udev (userspace /dev)
References
External links
Windows Hardware Dev CenterLinux Hardware Compatibility Lists and Linux DriversUnderstanding Modern Device Drivers(Linux)BinaryDriverHowto, Ubuntu.Linux Drivers Source
{{DEFAULTSORT:Device Driver
Linux drivers
Computing terminology
Windows NT kernel