95a46c5577
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
63 lines
2 KiB
Text
63 lines
2 KiB
Text
This directory should contain the mice-protocol implementations.
|
|
|
|
Each file (or if bigger: directory) implements one protocol.
|
|
|
|
You have to create three functions:
|
|
|
|
gpm2_open_<protocol>();
|
|
gpm2_handle_<protocol>();
|
|
gpm2_close_<protocol>();
|
|
|
|
It's not yet clear, how to register protocols to gpm2.
|
|
|
|
First idea of inclusion:
|
|
|
|
- create deps/mouse-<protocol> containging all dependencies
|
|
- conf/built-options/mice specifies which mice protocols to include
|
|
- a script generates include/gpm2-daemon-mice.h containg a struct-array
|
|
that looks like:
|
|
|
|
struct mice_protos {
|
|
char *name;
|
|
int (*open)();
|
|
int (*handle)();
|
|
int (*open)();
|
|
};
|
|
|
|
--------------------------------------------------------------------------------
|
|
More design ideas for using mice:
|
|
|
|
- The gpm2_handle function gets a pointer to a char array containing the
|
|
data packet.
|
|
- The gpm2_handle function returns what the packet means
|
|
- gpm2_daemon may then decide what todo with this information
|
|
|
|
--------------------------------------------------------------------------------
|
|
It would be nice to have a read_config_<proto> that reads and verifies
|
|
the protocol specific options.
|
|
|
|
For this, it would be nice to have a libcconfig() like this:
|
|
|
|
struct cconfig_fd *cconfig_open(char *dir);
|
|
struct cconfig_tree *cconfig_read_tree(struct cconfig_fd *which);
|
|
|
|
struct cconfig_element *cconfig_select_below(char *basepath, struct cconfig_fd *which, ...);
|
|
|
|
The tree, cconfig_read_tree creates could consist of elements
|
|
of the following definition:
|
|
|
|
struct cconfig_element {
|
|
char *path;
|
|
struct stat sbuf;
|
|
};
|
|
|
|
--------------------------------------------------------------------------------
|
|
gpm2_open_*:
|
|
- needs fd
|
|
- needs options
|
|
|
|
--------------------------------------------------------------------------------
|
|
struct datapacket *gpm2_read_*(int fd)
|
|
- reads one packet
|
|
- returns it
|
|
--------------------------------------------------------------------------------
|