input_module_t data type

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);
};
flags
Only one flag has been defined — MODULE_FLAG_INUSE, which indicates a valid module.
type
A combination (OR) of two descriptors:
  • driver class:
    • DEVI_CLASS_KBD — keyboard
    • DEVI_CLASS_REL — relative
    • DEVI_CLASS_ABS — absolute
  • driver layer that this module represents:
    • DEVI_MODULE_TYPE_FILTER — filter
    • DEVI_MODULE_TYPE_PROTO — protocol
    • DEVI_MODULE_TYPE_DEVICE — device
args
List of module parameters where each parameter is represented by a single character. If there's an optional argument, the parameter has the format x: (the : means that the optional argument is expected).
data
Usually a pointer to a module's local data. This can be assigned in the init() module function.