Periphery and Device Drivers
Let’s talk briefly about how operating systems communicate with the vast array of peripheral devices that are out there. We will use windows, just to make the discussion concrete, but similar concept will apply to other operating systems.
Every piece of hardware must have a unique identifier. This is usually a combination of a vendor id and a product id. When you connect a device to your computer, the device sends its hardware id to the operating system. The operating system then looks for a device driver that supports that hardware id. This mapping of hardware id to device driver is maintained in the windows registry. If no device driver is found, windows will look online, in windows update. Alternatively, you can manually find the device driver somewhere online and install it.
When you install a device driver, a file with a .sys extension is copied to your computer, usually in the C:/windows/system32/drivers
directory, and an entry is placed in the windows registry (mapping from hardware id to the .sys file).
So let’s back up again. You connect a device, the device sends windows its hardware id, windows looks at the registry to see if it has device drivers (.sys files) for that hardware id. If it does, it will load said files into memory. It will then use the code in said files (.sys files are executable files) to communicate with the device.
In general, you basically want to either 1) read from the device, 2) write to it, or 3) do a “control” operation. But ultimately, you are just exchanging bits between the sender and receiver. It is up to these parties to agree on how to interpret these bits.
You can use the Device Manager
in windows to see a list of all the devices connected to your computer, and the associated device drivers. Run Device Manager (search for it), right click on a device and click properties. Click on the driver
tab, then Driver Details
to see the .sys file that is being used.
You can also see a whole bunch of other information about the device in the details
tab.
This a short one! Thanks and hope you have an awesome day!