Changeset 2d1ba51 in mainline
- Timestamp:
- 2011-11-09T14:55:04Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 747ef72
- Parents:
- f317490
- Location:
- uspace/drv/bus/usb/usbhid
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
rf317490 r2d1ba51 103 103 /*----------------------------------------------------------------------------*/ 104 104 static const uint8_t USB_KBD_BOOT_REPORT_DESCRIPTOR[] = { 105 0x05, 0x01, // Usage Page (Generic Desktop), 106 0x09, 0x06, // Usage (Keyboard), 107 0xA1, 0x01, // Collection (Application), 108 0x75, 0x01, // Report Size (1), 109 0x95, 0x08, // Report Count (8), 110 0x05, 0x07, // Usage Page (Key Codes); 111 0x19, 0xE0, // Usage Minimum (224), 112 0x29, 0xE7, // Usage Maximum (231), 113 0x15, 0x00, // Logical Minimum (0), 114 0x25, 0x01, // Logical Maximum (1), 115 0x81, 0x02, // Input (Data, Variable, Absolute), ; Modifier byte 116 0x95, 0x01, // Report Count (1), 117 0x75, 0x08, // Report Size (8), 118 0x81, 0x01, // Input (Constant), ; Reserved byte 119 0x95, 0x05, // Report Count (5), 120 0x75, 0x01, // Report Size (1), 121 0x05, 0x08, // Usage Page (Page# for LEDs), 122 0x19, 0x01, // Usage Minimum (1), 123 0x29, 0x05, // Usage Maxmimum (5), 124 0x91, 0x02, // Output (Data, Variable, Absolute), ; LED report 125 0x95, 0x01, // Report Count (1), 126 0x75, 0x03, // Report Size (3), 127 0x91, 0x01, // Output (Constant), ; LED report padding 128 0x95, 0x06, // Report Count (6), 129 0x75, 0x08, // Report Size (8), 130 0x15, 0x00, // Logical Minimum (0), 131 0x25, 0xff, // Logical Maximum (255), 132 0x05, 0x07, // Usage Page (Key Codes), 133 0x19, 0x00, // Usage Minimum (0), 134 0x29, 0xff, // Usage Maximum (255), 135 0x81, 0x00, // Input (Data, Array), ; Key arrays (6 bytes) 136 0xC0 // End Collection 137 105 0x05, 0x01, /* Usage Page (Generic Desktop), */ 106 0x09, 0x06, /* Usage (Keyboard), */ 107 0xA1, 0x01, /* Collection (Application), */ 108 0x75, 0x01, /* Report Size (1), */ 109 0x95, 0x08, /* Report Count (8), */ 110 0x05, 0x07, /* Usage Page (Key Codes); */ 111 0x19, 0xE0, /* Usage Minimum (224), */ 112 0x29, 0xE7, /* Usage Maximum (231), */ 113 0x15, 0x00, /* Logical Minimum (0), */ 114 0x25, 0x01, /* Logical Maximum (1), */ 115 0x81, 0x02, /* Input (Data, Variable, Absolute), ; Modifier byte */ 116 0x95, 0x01, /* Report Count (1), */ 117 0x75, 0x08, /* Report Size (8), */ 118 0x81, 0x01, /* Input (Constant), ; Reserved byte */ 119 0x95, 0x05, /* Report Count (5), */ 120 0x75, 0x01, /* Report Size (1), */ 121 0x05, 0x08, /* Usage Page (Page# for LEDs), */ 122 0x19, 0x01, /* Usage Minimum (1), */ 123 0x29, 0x05, /* Usage Maxmimum (5), */ 124 0x91, 0x02, /* Output (Data, Variable, Absolute), ; LED report */ 125 0x95, 0x01, /* Report Count (1), */ 126 0x75, 0x03, /* Report Size (3), */ 127 0x91, 0x01, /* Output (Constant), ; LED report padding */ 128 0x95, 0x06, /* Report Count (6), */ 129 0x75, 0x08, /* Report Size (8), */ 130 0x15, 0x00, /* Logical Minimum (0), */ 131 0x25, 0xff, /* Logical Maximum (255), */ 132 0x05, 0x07, /* Usage Page (Key Codes), */ 133 0x19, 0x00, /* Usage Minimum (0), */ 134 0x29, 0xff, /* Usage Maximum (255), */ 135 0x81, 0x00, /* Input (Data, Array), ; Key arrays (6 bytes) */ 136 0xC0 /* End Collection */ 138 137 }; 139 138 /*----------------------------------------------------------------------------*/ … … 207 206 208 207 } 209 210 208 /*----------------------------------------------------------------------------*/ 211 209 /* Key processing functions */ … … 448 446 usb_hid_report_path_set_report_id(path, hid_dev->report_id); 449 447 450 // fill in the currently pressed keys 451 448 /* Fill in the currently pressed keys. */ 452 449 usb_hid_report_field_t *field = usb_hid_report_get_sibling( 453 450 &hid_dev->report, NULL, path, … … 462 459 assert(i < kbd_dev->key_count); 463 460 464 / / save the key usage461 /* Save the key usage. */ 465 462 if (field->value != 0) { 466 463 kbd_dev->keys[i] = field->usage; … … 500 497 } 501 498 502 /* 503 * Store the initialized HID device and HID ops 504 * to the DDF function. 505 */ 499 /* Store the initialized HID device and HID ops 500 * to the DDF function. */ 506 501 fun->ops = &kbd_dev->ops; 507 502 fun->driver_data = kbd_dev; … … 511 506 usb_log_error("Could not bind DDF function: %s.\n", 512 507 str_error(rc)); 513 fun->driver_data = NULL; /* We need this later*/508 fun->driver_data = NULL; /* We did not allocate this. */ 514 509 ddf_fun_destroy(fun); 515 510 return rc; … … 527 522 HID_KBD_CLASS_NAME, str_error(rc)); 528 523 if (ddf_fun_unbind(fun) == EOK) { 529 fun->driver_data = NULL; /* We need this later*/524 fun->driver_data = NULL; /* We did not allocate this. */ 530 525 ddf_fun_destroy(fun); 531 526 } else { … … 674 669 } 675 670 676 /* 677 * Set LEDs according to initial setup. 678 * Set Idle rate 679 */ 671 /* Set LEDs according to initial setup. 672 * Set Idle rate */ 680 673 usb_kbd_set_led(hid_dev, kbd_dev); 681 674 … … 779 772 if (usb_kbd_is_initialized(kbd_dev)) { 780 773 kbd_dev->initialized = USB_KBD_STATUS_TO_DESTROY; 781 /* wait for autorepeat */774 /* Wait for autorepeat */ 782 775 async_usleep(CHECK_DELAY); 783 776 } -
uspace/drv/bus/usb/usbhid/kbd/kbdrepeat.c
rf317490 r2d1ba51 45 45 #include "kbddev.h" 46 46 47 48 49 /*----------------------------------------------------------------------------*/50 47 /** 51 48 * Main loop handling the auto-repeat of keys. … … 58 55 * If the same key is still pressed, it uses the delay between repeats stored 59 56 * in the keyboard structure to wait until the key should be repeated. 60 * 57 * 61 58 * If the currently repeated key is not pressed any more ( 62 * usb_kbd_repeat_stop() was called), it stops repeating it and starts 59 * usb_kbd_repeat_stop() was called), it stops repeating it and starts 63 60 * checking again. 64 61 * 65 62 * @note For accessing the keyboard device auto-repeat information a fibril 66 63 * mutex (repeat_mtx) from the @a kbd structure is used. 67 * 64 * 68 65 * @param kbd Keyboard device structure. 69 66 */ … … 75 72 76 73 while (true) { 77 / / check if the kbd structure is usable74 /* Check if the kbd structure is usable. */ 78 75 if (!usb_kbd_is_initialized(kbd)) { 79 76 usb_log_warning("kbd not ready, exiting autorepeat.\n"); 80 77 return; 81 78 } 82 79 83 80 fibril_mutex_lock(&kbd->repeat_mtx); 84 81 … … 105 102 } 106 103 fibril_mutex_unlock(&kbd->repeat_mtx); 107 108 104 async_usleep(delay); 109 105 } 110 106 } 111 112 107 /*----------------------------------------------------------------------------*/ 113 108 /** … … 115 110 * 116 111 * Starts the loop for checking changes in auto-repeat. 117 * 112 * 118 113 * @param arg User-specified argument. Expects pointer to the keyboard device 119 114 * structure representing the keyboard. … … 131 126 } 132 127 133 usb_kbd_t *kbd = (usb_kbd_t *)arg;128 usb_kbd_t *kbd = arg; 134 129 135 130 usb_kbd_repeat_loop(kbd); … … 137 132 return EOK; 138 133 } 139 140 134 /*----------------------------------------------------------------------------*/ 141 135 /** … … 155 149 fibril_mutex_unlock(&kbd->repeat_mtx); 156 150 } 157 158 151 /*----------------------------------------------------------------------------*/ 159 152 /** … … 161 154 * 162 155 * @note Only one key is repeated at any time, but this function may be called 163 * even with key that is not currently repeated (in that case nothing 156 * even with key that is not currently repeated (in that case nothing 164 157 * happens). 165 158 * … … 175 168 fibril_mutex_unlock(&kbd->repeat_mtx); 176 169 } 177 178 170 /** 179 171 * @} -
uspace/drv/bus/usb/usbhid/usbhid.c
rf317490 r2d1ba51 249 249 usb_log_debug("Comparing device against usage path.\n"); 250 250 if (usb_hid_path_matches(hid_dev, mapping)) { 251 / / does not matter if IDs were matched251 /* Does not matter if IDs were matched. */ 252 252 matched = true; 253 253 }
Note:
See TracChangeset
for help on using the changeset viewer.