Changeset 76fbd9a in mainline for uspace/drv/bus/usb/usbhid/kbd/kbddev.c
- Timestamp:
- 2012-02-24T19:07:44Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a76b01b4
- Parents:
- 5837c7a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
r5837c7a r76fbd9a 73 73 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); 74 74 static ddf_dev_ops_t kbdops = { .default_handler = default_connection_handler }; 75 /*----------------------------------------------------------------------------*/ 75 76 76 77 77 static const unsigned DEFAULT_ACTIVE_MODS = KM_NUM_LOCK; … … 88 88 static const unsigned int DEFAULT_REPEAT_DELAY = 50 * 1000; 89 89 90 /*----------------------------------------------------------------------------*/ 90 91 91 /** Keyboard polling endpoint description for boot protocol class. */ 92 92 const usb_endpoint_description_t usb_hid_kbd_poll_endpoint_description = { … … 103 103 104 104 static void usb_kbd_set_led(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev); 105 /*----------------------------------------------------------------------------*/ 105 106 106 static const uint8_t USB_KBD_BOOT_REPORT_DESCRIPTOR[] = { 107 107 0x05, 0x01, /* Usage Page (Generic Desktop), */ … … 138 138 0xC0 /* End Collection */ 139 139 }; 140 /*----------------------------------------------------------------------------*/ 140 141 141 typedef enum usb_kbd_flags { 142 142 USB_KBD_STATUS_UNINITIALIZED = 0, … … 144 144 USB_KBD_STATUS_TO_DESTROY = -1 145 145 } usb_kbd_flags; 146 /*----------------------------------------------------------------------------*/ 146 147 147 /* IPC method handler */ 148 /*----------------------------------------------------------------------------*/ 148 149 149 /** 150 150 * Default handler for IPC methods not handled by DDF. … … 208 208 209 209 } 210 /*----------------------------------------------------------------------------*/ 210 211 211 /* Key processing functions */ 212 /*----------------------------------------------------------------------------*/ 212 213 213 /** 214 214 * Handles turning of LED lights on and off. … … 283 283 } 284 284 } 285 /*----------------------------------------------------------------------------*/ 285 286 286 /** Send key event. 287 287 * … … 308 308 } 309 309 } 310 /*----------------------------------------------------------------------------*/ 310 311 311 static inline int usb_kbd_is_lock(unsigned int key_code) 312 312 { … … 315 315 || key_code == KC_CAPS_LOCK); 316 316 } 317 /*----------------------------------------------------------------------------*/ 317 318 318 static size_t find_in_array_int32(int32_t val, int32_t *arr, size_t arr_size) 319 319 { … … 326 326 return (size_t) -1; 327 327 } 328 /*----------------------------------------------------------------------------*/ 328 329 329 /** 330 330 * Checks if some keys were pressed or released and generates key events. … … 409 409 usb_log_debug2("Stored keys %s.\n", key_buffer); 410 410 } 411 /*----------------------------------------------------------------------------*/ 411 412 412 /* General kbd functions */ 413 /*----------------------------------------------------------------------------*/ 413 414 414 /** 415 415 * Processes data received from the device in form of report. … … 481 481 usb_kbd_check_key_changes(hid_dev, kbd_dev); 482 482 } 483 /*----------------------------------------------------------------------------*/ 483 484 484 /* HID/KBD structure manipulation */ 485 /*----------------------------------------------------------------------------*/ 485 486 486 static int usb_kbd_create_function(usb_kbd_t *kbd_dev) 487 487 { … … 537 537 return EOK; 538 538 } 539 /*----------------------------------------------------------------------------*/ 539 540 540 /* API functions */ 541 /*----------------------------------------------------------------------------*/ 541 542 542 /** 543 543 * Initialization of the USB/HID keyboard structure. … … 701 701 return EOK; 702 702 } 703 /*----------------------------------------------------------------------------*/ 703 704 704 bool usb_kbd_polling_callback(usb_hid_dev_t *hid_dev, void *data) 705 705 { … … 715 715 return true; 716 716 } 717 /*----------------------------------------------------------------------------*/ 717 718 718 int usb_kbd_is_initialized(const usb_kbd_t *kbd_dev) 719 719 { 720 720 return (kbd_dev->initialized == USB_KBD_STATUS_INITIALIZED); 721 721 } 722 /*----------------------------------------------------------------------------*/ 722 723 723 int usb_kbd_is_ready_to_destroy(const usb_kbd_t *kbd_dev) 724 724 { 725 725 return (kbd_dev->initialized == USB_KBD_STATUS_TO_DESTROY); 726 726 } 727 /*----------------------------------------------------------------------------*/ 727 728 728 /** 729 729 * Properly destroys the USB/HID keyboard structure. … … 766 766 free(kbd_dev); 767 767 } 768 /*----------------------------------------------------------------------------*/ 768 769 769 void usb_kbd_deinit(usb_hid_dev_t *hid_dev, void *data) 770 770 { … … 779 779 } 780 780 } 781 /*----------------------------------------------------------------------------*/ 781 782 782 int usb_kbd_set_boot_protocol(usb_hid_dev_t *hid_dev) 783 783 {
Note:
See TracChangeset
for help on using the changeset viewer.