Device Drivers:
Every piece of hardware that connects to a computer will have a device driver that allows the computer system to communicate with it. Some drivers will be preinstalled with the OS, the right ones are loaded on boot up. The exact details of the driver will be kept in a file, called the registry in Windows. Makers of hardware will provide the device drivers for the piece of hardware and the specific OS.
When an application asks the OS to save a file or access any connected device, the OS needs to make use of a hardware driver. Hardware drivers are simply software that understands how to talk directly to a given piece of hardware. Drivers are normally produced by the manufacturer of the hardware, but can also be produced by OS manufacturers and even the open-source community. As all devices are different, the OS needs to have a generic way of talking to devices of the same type. This generic communication is not understood by the hardware itself and requires translation into the correct binary control signals. Hardware drivers perform this translation from the generic instructions sent by the OS to the specific instructions understood by the hardware. Drivers are only loaded by the OS, if specific hardware has been connected to the PC and requires installation. They are modular in nature and can be loaded on demand. Most OS installations will detect what hardware the user has and try to install the required drivers when the OS is installed. This functionality works by each device having two codes, a vendor ID (VID) and a product ID (PID). When a device is connected, the OS queries the device for these two codes. It then checks its database of known vendors and products to see if a suitable device driver can be found. If not, the user will have to install one before that device can be used.
Sometimes the OS will install generic drivers that will not be able to use the full range of features of the device. When setting up a new OS, you will have to install drivers for every piece of hardware on your PC. To see what drivers your system is currently using, you will need to load Device Manager for Windows or System Profiler on a Mac. On Linux the easiest way to see what devices are installed is to run ‘lspci’ or ‘lsusb’ from the command line.
What a device driver does:
A device driver understands how to talk to a particular piece of hardware, it translates the generic way an OS communicates to hardware into the correct binary signals for the hardware. When a new piece of hardware is installed the device driver will be installed using the Vendor and Product ID from the device so that it can automatically download the correct driver.