Added the function to read from a device.