Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| kgiinputapi [2005/02/20 22:44] – NicholasSouchu | kgiinputapi [2022/06/10 02:28] (current) – Remove page: content now on KGI KubilayKocak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== kii_input_t ==== | ||
| - | |||
| - | * The next input in the linked list | ||
| - | |||
| - | < | ||
| - | kii_input_t *next; | ||
| - | </ | ||
| - | |||
| - | * The focus we belong to | ||
| - | |||
| - | < | ||
| - | kii_u_t focus; | ||
| - | </ | ||
| - | |||
| - | * Unique input device ID | ||
| - | |||
| - | < | ||
| - | kii_u_t id; | ||
| - | </ | ||
| - | |||
| - | * Bit mask of generated events | ||
| - | |||
| - | < | ||
| - | kii_event_mask_t events; | ||
| - | </ | ||
| - | |||
| - | * Bit mask of events to report | ||
| - | |||
| - | < | ||
| - | kii_event_mask_t report; | ||
| - | </ | ||
| - | |||
| - | * Vendor and Model strings for info only | ||
| - | |||
| - | < | ||
| - | kii_ascii_t | ||
| - | kii_ascii_t | ||
| - | </ | ||
| - | |||
| - | * Method for executing a command specific to the input | ||
| - | |||
| - | < | ||
| - | int (*Command)(kii_input_t *, kii_u_t cmd, void *); | ||
| - | </ | ||
| - | |||
| - | * Method called to poll a 32bits scancode | ||
| - | |||
| - | < | ||
| - | int (*Poll)(kii_input_t *); | ||
| - | </ | ||
| - | |||
| - | * Method called to parse a 32bits scancode got by Poll method | ||
| - | |||
| - | < | ||
| - | void (*Parse)(kii_input_t *, kii_event_t *, int); | ||
| - | </ | ||
| - | |||
| - | * Private data of the input | ||
| - | |||
| - | < | ||
| - | kii_private_t | ||
| - | </ | ||
| - | |||
| - | ==== kii_register_input() ==== | ||
| - | |||
| - | kii_register_input() is typically called when a new input driver is loaded. | ||
| - | |||
| - | < | ||
| - | kii_error_t kii_register_input( | ||
| - | |||
| - | /* Comment: the focus to register to */ | ||
| - | | ||
| - | |||
| - | /* Comment: preinitialized data about the input to register */ | ||
| - | | ||
| - | ); | ||
| - | </ | ||
| - | |||
| - | The return code is null (KII_EOK) on succes. Otherwise, the appropriate return code is given back. | ||
| - | |||
| - | A typical registration of an input is like this: | ||
| - | |||
| - | < | ||
| - | snprintf(sc-> | ||
| - | snprintf(sc-> | ||
| - | sc-> | ||
| - | sc-> | ||
| - | sc-> | ||
| - | sc-> | ||
| - | sc-> | ||
| - | |||
| - | kii_error = kii_register_input((~0), | ||
| - | </ | ||
| - | |||
| - | In the above example, KII_INVALID_FOCUS is passed as focus id to let [" | ||
| - | according to its capabilities e.g sc-> | ||
| - | the software data pointer of the kbd device. | ||
| - | |||
| - | kbdriver_parser() takes scancodes from the RAW output of a kbd and fills the event structure passed in. | ||
| - | Event is only reported to [" | ||
| - | |||
| - | Here is another example of registration: | ||
| - | |||
| - | < | ||
| - | snprintf(mouse-> | ||
| - | snprintf(mouse-> | ||
| - | |||
| - | mouse-> | ||
| - | mouse-> | ||
| - | mouse-> | ||
| - | mouse-> | ||
| - | mouse-> | ||
| - | |||
| - | /* XXX Force registration to focus 0 */ | ||
| - | if (!(error = kii_register_input(0, | ||
| - | make_dev(& | ||
| - | UID_ROOT, GID_WHEEL, 0600, " | ||
| - | } else { | ||
| - | KRN_ERROR(" | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | The above registration comes from the scemul device provided by KII to %%FreeBSD%%. It emulates the | ||
| - | / | ||
| - | This data is processed internally and sent back to userland by / | ||
| - | |||
| - | In this example, no Parser or Poll methods are set. Instead, scemul responds to the mouse | ||
| - | daemon inputs by sending directly the event to KII. | ||
| - | |||
| - | ==== kii_unregister_input() ==== | ||
| - | |||
| - | kii_unregister_input() is typically called when the module of an input driver is unloaded. | ||
| - | |||
| - | < | ||
| - | void kii_unregister_input( | ||
| - | |||
| - | /* Comment: the input to unregister from its focus */ | ||
| - | | ||
| - | ); | ||
| - | </ | ||