What sort of code do you use to read other stuff?

usually there is a protocol defined (or in the case of a consumer product sniffed out and documented) and from there you can start writing code to talk back (if it doesnt exist already, for example in the library)

sometimes they use industry standards like spi or I2C, sometimes its totally propitiatory like apple ADB