Linux provides a standardized interface for accessing I²C buses directly from userspace, through device files exposed under /dev/. These interfaces allow developers to communicate with bus-attached devices using standard read() / write() / ioctl() calls, without the need to. This is a small guide for those who want to write kernel drivers for I2C or SMBus devices, using Linux as the protocol host/master (not slave). To set up a driver, you need to do several things. Some are optional, and some things can be done slightly or completely different. Use this as a guide. Welcome to my guide on leveraging the handy I2C utilities included with Linux to communicate with sensors, microcontrollers, and other devices using the I2C serial interface. For short-distance communication between integrated circuits and peripherals, the Inter-Integrated Circuit (I2C) protocol is. The I²C (Inter-Integrated Circuit) subsystem in Linux provides a structured way for the kernel to communicate with I²C devices—peripherals that share a common two-wire bus consisting of data (SDA) and clock (SCL) lines.
[PDF Version]