Changes in uspace/drv/usbkbd/main.c [700af62:f9a0cef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbkbd/main.c
r700af62 rf9a0cef 29 29 #include <driver.h> 30 30 #include <ipc/driver.h> 31 #include <ipc/kbd.h>32 #include <io/keycode.h>33 #include <io/console.h>34 31 #include <errno.h> 35 32 #include <fibril.h> … … 44 41 #define GUESSED_POLL_ENDPOINT 1 45 42 46 static void default_connection_handler(device_t *, ipc_callid_t, ipc_call_t *);47 static device_ops_t keyboard_ops = {48 .default_handler = default_connection_handler49 };50 51 static int console_callback_phone = -1;52 53 /** Default handler for IPC methods not handled by DDF.54 *55 * @param dev Device handling the call.56 * @param icallid Call id.57 * @param icall Call data.58 */59 void default_connection_handler(device_t *dev,60 ipc_callid_t icallid, ipc_call_t *icall)61 {62 sysarg_t method = IPC_GET_IMETHOD(*icall);63 64 if (method == IPC_M_CONNECT_TO_ME) {65 int callback = IPC_GET_ARG5(*icall);66 67 if (console_callback_phone != -1) {68 ipc_answer_0(icallid, ELIMIT);69 return;70 }71 72 console_callback_phone = callback;73 ipc_answer_0(icallid, EOK);74 return;75 }76 77 ipc_answer_0(icallid, EINVAL);78 }79 80 static void send_key(int key, int type, wchar_t c) {81 async_msg_4(console_callback_phone, KBD_EVENT, type, key,82 KM_NUM_LOCK, c);83 }84 85 static void send_alnum(int key, wchar_t c) {86 printf(NAME ": sending key '%lc' to console\n", c);87 send_key(key, KEY_PRESS, c);88 send_key(key, KEY_RELEASE, c);89 }90 91 43 /* 92 44 * Callbacks for parser … … 231 183 sizeof(usb_hid_report_in_callbacks_t)); 232 184 callbacks->keyboard = usbkbd_process_keycodes; 233 234 if (console_callback_phone != -1) {235 static size_t counter = 0;236 counter++;237 if (counter > 3) {238 counter = 0;239 send_alnum(KC_A, L'a');240 }241 }242 185 243 186 usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks, … … 346 289 fibril_add_ready(fid); 347 290 348 dev->ops = &keyboard_ops;349 350 add_device_to_class(dev, "keyboard");351 352 291 /* 353 292 * Hurrah, device is initialized.
Note:
See TracChangeset
for help on using the changeset viewer.