This is a demonstration showing how to use Protocol Buffer in a Linux kernel module or typically a device driver.
In embedded system, typically hand-written C struct definitions are used to pass data around even for cross-chip communication. This interface contract between two sides (e.g. device driver and firmware) is too rigid to change. One cannot change the interface without breaking compatibility with the other side. Protocol Buffer can provide versioning mechanism to allow evolving either side independently.
Nanopb is a Protocol Buffer implementation designed for embedded systems. It has small code size and require less than 1KB RAM to run. Besides its dependencies on C runtime library is minimized so that it can be easily ported to be used in Linux kernel. Integrating Nanopb with a kernel module can be done without breaking a sweat.