Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
kgiinputapi [2005/02/20 22:44] – NicholasSouchukgiinputapi [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 
- 
-<code> 
-kii_input_t *next; 
-</code> 
- 
-  * The focus we belong to 
- 
-<code> 
-kii_u_t focus; 
-</code> 
- 
-  * Unique input device ID 
- 
-<code> 
-kii_u_t id; 
-</code> 
- 
-  * Bit mask of generated events 
- 
-<code> 
-kii_event_mask_t events; 
-</code> 
- 
-  * Bit mask of events to report 
- 
-<code> 
-kii_event_mask_t report; 
-</code> 
- 
-  * Vendor and Model strings for info only 
- 
-<code> 
-kii_ascii_t         vendor[KII_MAX_VENDOR_STRING]; 
-kii_ascii_t         model[KII_MAX_MODEL_STRING]; 
-</code> 
- 
-  * Method for executing a command specific to the input 
- 
-<code> 
-int (*Command)(kii_input_t *, kii_u_t cmd, void *); 
-</code> 
- 
-  * Method called to poll a 32bits scancode 
- 
-<code> 
-int (*Poll)(kii_input_t *); 
-</code> 
- 
-  * Method called to parse a 32bits scancode got by Poll method 
- 
-<code> 
-void (*Parse)(kii_input_t *, kii_event_t *, int); 
-</code> 
- 
-  * Private data of the input 
- 
-<code> 
-kii_private_t         priv; 
-</code> 
- 
-==== kii_register_input() ==== 
- 
-kii_register_input() is typically called when a new input driver is loaded. 
- 
-<code> 
-kii_error_t kii_register_input( 
- 
- /* Comment: the focus to register to */ 
- kii_u_t focus, 
- 
- /* Comment: preinitialized data about the input to register */ 
- kii_input_t *dev 
-); 
-</code> 
- 
-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: 
- 
-<code> 
-snprintf(sc->kii_input.vendor, KII_MAX_VENDOR_STRING, "KII FreeBSD keyboard"); 
-snprintf(sc->kii_input.model, KII_MAX_VENDOR_STRING, kbd->kb_name); 
-sc->kii_input.events = KII_EM_KEY | KII_EM_RAW_DATA; 
-sc->kii_input.report = KII_EM_KEY | KII_EM_RAW_DATA; 
-sc->kii_input.priv.priv_ptr = sc; 
-sc->kii_input.Poll = kbdriver_poll; 
-sc->kii_input.Parse = kbdriver_parser; 
- 
-kii_error = kii_register_input((~0), &sc->kii_input); 
-</code> 
- 
-In the above example, KII_INVALID_FOCUS is passed as focus id to let ["KII"] auto register the input 
-according to its capabilities e.g sc->kii_input.events. sc->kii_input.priv.priv_ptr is initialized with 
-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 ["KII"] if the event type corresponds (e.g bit set) in sc->kii_input.report. 
- 
-Here is another example of registration: 
- 
-<code> 
-snprintf(mouse->input.vendor, KII_MAX_VENDOR_STRING, "FreeBSD"); 
-snprintf(mouse->input.model, KII_MAX_VENDOR_STRING,  "Syscons Emulation Mouse"); 
- 
-mouse->input.focus = KII_INVALID_FOCUS; 
-mouse->input.id = KII_INVALID_DEVICE; 
-mouse->input.events = KII_EM_POINTER & ~KII_EM_PTR_ABSOLUTE; 
-mouse->input.report = KII_EM_PTR_RELATIVE | KII_EM_PTR_BUTTON; 
-mouse->input.priv.priv_ptr = mouse; 
- 
-/* XXX Force registration to focus 0 */ 
-if (!(error = kii_register_input(0, &mouse->input))) { 
- make_dev(&scectl_cdevsw, SC_CONSOLECTL, 
- UID_ROOT, GID_WHEEL, 0600, "consolectl"); 
-} else { 
- KRN_ERROR("Could not register sce_mouse"); 
-} 
-</code> 
- 
-The above registration comes from the scemul device provided by KII to %%FreeBSD%%. It emulates the 
-/dev/consolectl interface to which the general purpose mouse daemon sends data on mouse events. 
-This data is processed internally and sent back to userland by /dev/sysmouse or /dev/event. 
- 
-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. 
- 
-<code> 
-void kii_unregister_input( 
- 
- /* Comment: the input to unregister from its focus */ 
- kii_input_t *dev 
-); 
-</code> 
  
  • kgiinputapi.1108939450.txt.gz
  • Last modified: 2005/02/20 22:44
  • by NicholasSouchu