Changeset e50cd7f in mainline for uspace/drv/usbkbd
- Timestamp:
- 2011-04-17T19:17:55Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63517c2, cfbbe1d3
- Parents:
- ef354b6 (diff), 8595577b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/drv/usbkbd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbkbd/kbddev.c
ref354b6 re50cd7f 268 268 static void usb_kbd_set_led(usb_kbd_t *kbd_dev) 269 269 { 270 if (kbd_dev->output_size == 0) { 271 return; 272 } 273 270 274 unsigned i = 0; 271 275 … … 544 548 * according to HID Usage Tables. 545 549 * @param count Number of key codes in report (size of the report). 546 * @param modifiers Bitmap of modifiers (Ctrl, Alt, Shift, GUI).550 * @param report_id 547 551 * @param arg User-specified argument. Expects pointer to the keyboard device 548 552 * structure representing the keyboard. … … 551 555 */ 552 556 static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count, 553 uint8_t modifiers, void *arg)557 uint8_t report_id, void *arg) 554 558 { 555 559 if (arg == NULL) { … … 562 566 assert(kbd_dev != NULL); 563 567 564 usb_log_debug("Got keys from parser (report id: %d): %s\n", modifiers,568 usb_log_debug("Got keys from parser (report id: %d): %s\n", report_id, 565 569 usb_debug_str_buffer(key_codes, count, 0)); 566 570 … … 763 767 usb_hid_report_path_t *path = usb_hid_report_path(); 764 768 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 769 770 usb_hid_report_path_set_report_id(path, 0); 771 765 772 kbd_dev->key_count = usb_hid_report_input_length( 766 773 kbd_dev->parser, path, USB_HID_PATH_COMPARE_END); … … 796 803 797 804 kbd_dev->led_output_size = usb_hid_report_output_size(kbd_dev->parser, 798 kbd_dev->led_path, USB_HID_PATH_COMPARE_END); 805 kbd_dev->led_path, 806 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY); 799 807 800 808 usb_log_debug("Output report size (in items): %zu\n", -
uspace/drv/usbkbd/main.c
ref354b6 re50cd7f 33 33 /** 34 34 * @file 35 * Main routines of USB HID driver.35 * Main routines of USB KBD driver. 36 36 */ 37 37 … … 42 42 43 43 #include <usb/devdrv.h> 44 #include <usb/devpoll.h> 44 45 45 46 #include "kbddev.h" … … 75 76 * @sa usb_kbd_fibril(), usb_kbd_repeat_fibril() 76 77 */ 77 static int usb hid_try_add_device(usb_device_t *dev)78 static int usb_kbd_try_add_device(usb_device_t *dev) 78 79 { 79 80 /* Create the function exposed under /dev/devices. */ … … 105 106 usb_kbd_free(&kbd_dev); 106 107 return rc; 107 } 108 } 108 109 109 110 usb_log_debug("USB/HID KBD device structure initialized.\n"); … … 195 196 * @retval EREFUSED if the device is not supported. 196 197 */ 197 static int usb hid_add_device(usb_device_t *dev)198 static int usb_kbd_add_device(usb_device_t *dev) 198 199 { 199 usb_log_debug("usb hid_add_device()\n");200 usb_log_debug("usb_kbd_add_device()\n"); 200 201 201 202 if (dev->interface_no < 0) { 202 203 usb_log_warning("Device is not a supported keyboard.\n"); 203 usb_log_error("Failed to add HID device: endpoint not found."204 " \n");204 usb_log_error("Failed to add USB KBD device: endpoint not " 205 "found.\n"); 205 206 return ENOTSUP; 206 207 } 207 208 208 int rc = usb hid_try_add_device(dev);209 int rc = usb_kbd_try_add_device(dev); 209 210 210 211 if (rc != EOK) { 211 212 usb_log_warning("Device is not a supported keyboard.\n"); 212 usb_log_error("Failed to add HID device: %s.\n",213 usb_log_error("Failed to add KBD device: %s.\n", 213 214 str_error(rc)); 214 215 return rc; … … 224 225 /* Currently, the framework supports only device adding. Once the framework 225 226 * supports unplug, more callbacks will be added. */ 226 static usb_driver_ops_t usb hid_driver_ops = {227 .add_device = usb hid_add_device,227 static usb_driver_ops_t usb_kbd_driver_ops = { 228 .add_device = usb_kbd_add_device, 228 229 }; 229 230 230 231 231 232 /* The driver itself. */ 232 static usb_driver_t usb hid_driver = {233 static usb_driver_t usb_kbd_driver = { 233 234 .name = NAME, 234 .ops = &usb hid_driver_ops,235 .ops = &usb_kbd_driver_ops, 235 236 .endpoints = usb_kbd_endpoints 236 237 }; … … 238 239 /*----------------------------------------------------------------------------*/ 239 240 240 //static driver_ops_t kbd_driver_ops = {241 // .add_device = usbhid_add_device,242 //};243 244 ///*----------------------------------------------------------------------------*/245 246 //static driver_t kbd_driver = {247 // .name = NAME,248 // .driver_ops = &kbd_driver_ops249 //};250 251 /*----------------------------------------------------------------------------*/252 253 241 int main(int argc, char *argv[]) 254 242 { 255 printf(NAME ": HelenOS USB HID driver.\n");243 printf(NAME ": HelenOS USB KBD driver.\n"); 256 244 257 245 usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME); 258 246 259 return usb_driver_main(&usb hid_driver);247 return usb_driver_main(&usb_kbd_driver); 260 248 } 261 249 -
uspace/drv/usbkbd/usbkbd.ma
ref354b6 re50cd7f 1 100 usb&interface&class=HID&subclass=0x01&protocol=0x01 2 10 usb&interface&class=HID 1 10 usb&interface&class=HID&subclass=0x01&protocol=0x01
Note:
See TracChangeset
for help on using the changeset viewer.
