Writing an input module consists of simply creating an input_module_t representing your module and filling in the relevant interface functions.
struct _input_module { input_module_t *up; // Up and down modules in bus line - input_module_t *down; // for internal use only struct Line *line; // driver bus line - for internal use only int flags; // module flags int type; // type of module char name[12]; // module name (used in devi-* commands) char date[12]; // date of compilation const char *args; // list of module args (used in devi-* commands) void *data; // private module data // pointers to user-supplied module functions int (*init)(input_module_t *); int (*reset)(input_module_t *); int (*input)(input_module_t *, int, void *); int (*output)(input_module_t *, void *, int); int (*pulse)(message_context_t *, int, unsigned, void *); int (*parm)(input_module_t *, int, char *); int (*devctrl)(input_module_t *, int, void *); int (*shutdown)(input_module_t *, int); };