Changeset 06f9d8fb in mainline
- Timestamp:
- 2011-05-30T20:02:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c3dafe1
- Parents:
- be8d907 (diff), 63862a0 (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
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ehci-hcd/main.c
rbe8d907 r06f9d8fb 75 75 } 76 76 77 uintptr_t mem_reg_base = 0;78 size_t mem_reg_size = 0;77 uintptr_t reg_base = 0; 78 size_t reg_size = 0; 79 79 int irq = 0; 80 80 81 int ret = 82 pci_get_my_registers(device, &mem_reg_base, &mem_reg_size, &irq); 81 int ret = pci_get_my_registers(device, ®_base, ®_size, &irq); 83 82 CHECK_RET_RETURN(ret, 84 83 "Failed to get memory addresses for %" PRIun ": %s.\n", 85 84 device->handle, str_error(ret)); 86 85 usb_log_info("Memory mapped regs at 0x%" PRIxn " (size %zu), IRQ %d.\n", 87 mem_reg_base, mem_reg_size, irq);86 reg_base, reg_size, irq); 88 87 89 ret = pci_disable_legacy(device );88 ret = pci_disable_legacy(device, reg_base, reg_size, irq); 90 89 CHECK_RET_RETURN(ret, 91 90 "Failed(%d) disable legacy USB: %s.\n", ret, str_error(ret)); -
uspace/drv/ehci-hcd/pci.c
rbe8d907 r06f9d8fb 87 87 } while(0) 88 88 89 static int pci_read32( ddf_dev_t *dev, int address, uint32_t *value)89 static int pci_read32(const ddf_dev_t *dev, int address, uint32_t *value) 90 90 { 91 91 PCI_READ(32); 92 92 } 93 static int pci_read16( ddf_dev_t *dev, int address, uint16_t *value)93 static int pci_read16(const ddf_dev_t *dev, int address, uint16_t *value) 94 94 { 95 95 PCI_READ(16); 96 96 } 97 static int pci_read8( ddf_dev_t *dev, int address, uint8_t *value)97 static int pci_read8(const ddf_dev_t *dev, int address, uint8_t *value) 98 98 { 99 99 PCI_READ(8); … … 115 115 } while(0) 116 116 117 static int pci_write32( ddf_dev_t *dev, int address, uint32_t value)117 static int pci_write32(const ddf_dev_t *dev, int address, uint32_t value) 118 118 { 119 119 PCI_WRITE(32); 120 120 } 121 static int pci_write16( ddf_dev_t *dev, int address, uint16_t value)121 static int pci_write16(const ddf_dev_t *dev, int address, uint16_t value) 122 122 { 123 123 PCI_WRITE(16); 124 124 } 125 static int pci_write8( ddf_dev_t *dev, int address, uint8_t value)125 static int pci_write8(const ddf_dev_t *dev, int address, uint8_t value) 126 126 { 127 127 PCI_WRITE(8); … … 136 136 * @return Error code. 137 137 */ 138 int pci_get_my_registers( ddf_dev_t *dev,138 int pci_get_my_registers(const ddf_dev_t *dev, 139 139 uintptr_t *mem_reg_address, size_t *mem_reg_size, int *irq_no) 140 140 { … … 206 206 * @return Error code. 207 207 */ 208 int pci_enable_interrupts( ddf_dev_t *device)208 int pci_enable_interrupts(const ddf_dev_t *device) 209 209 { 210 210 const int parent_phone = … … 223 223 * @return Error code. 224 224 */ 225 int pci_disable_legacy(ddf_dev_t *device) 225 int pci_disable_legacy( 226 const ddf_dev_t *device, uintptr_t reg_base, size_t reg_size, int irq) 226 227 { 227 228 assert(device); … … 236 237 } else (void)0 237 238 238 uintptr_t reg_base = 0; 239 size_t reg_size = 0; 240 int irq = 0; 241 242 int ret = pci_get_my_registers(device, ®_base, ®_size, &irq); 243 CHECK_RET_RETURN(ret, "Failed(%d) to get EHCI registers.\n", ret); 244 245 usb_log_info("EHCI: Memory registers:%p size: %zu irq:%d.\n", 246 (void *) reg_base, reg_size, irq); 247 248 249 /* map EHCI registers */ 239 /* Map EHCI registers */ 250 240 void *regs = NULL; 251 ret = pio_enable((void*)reg_base, reg_size, ®s);241 int ret = pio_enable((void*)reg_base, reg_size, ®s); 252 242 CHECK_RET_RETURN(ret, "Failed(%d) to map registers %p.\n", 253 243 ret, (void *) reg_base); … … 316 306 CHECK_RET_RETURN(ret, 317 307 "Failed(%d) zero USBLEGCTLSTS.\n", ret); 308 udelay(10); 318 309 ret = pci_read32( 319 310 device, eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts); … … 350 341 usb_log_debug("USBCMD value: %x.\n", *usbcmd); 351 342 if (*usbcmd & USBCMD_RUN) { 352 *usbcmd = 0;353 /* Wait until hc is halted */354 while ((*usbsts & USBSTS_HALTED) != 0);355 343 *usbsts = 0x3f; /* ack all interrupts */ 356 344 *usbint = 0; /* disable all interrutps */ 357 345 *usbconf = 0; /* relase control of RH ports */ 346 347 *usbcmd = 0; 348 /* Wait until hc is halted */ 349 while ((*usbsts & USBSTS_HALTED) == 0); 358 350 usb_log_info("EHCI turned off.\n"); 359 351 } else { -
uspace/drv/ehci-hcd/pci.h
rbe8d907 r06f9d8fb 38 38 #include <ddf/driver.h> 39 39 40 int pci_get_my_registers( ddf_dev_t *, uintptr_t *, size_t *, int *);41 int pci_enable_interrupts( ddf_dev_t *);42 int pci_disable_legacy( ddf_dev_t *);40 int pci_get_my_registers(const ddf_dev_t *, uintptr_t *, size_t *, int *); 41 int pci_enable_interrupts(const ddf_dev_t *); 42 int pci_disable_legacy(const ddf_dev_t *, uintptr_t, size_t, int); 43 43 44 44 #endif -
uspace/drv/usbhid/generic/hiddev.c
rbe8d907 r06f9d8fb 126 126 } 127 127 128 /*! @todo This should probably be atomic. */ 129 // if (usb_hid_report_ready()) { 130 // usb_log_debug2("Report ready, size: %zu\n", 131 // hid_dev->input_report_size); 132 133 // usb_hid_report_received(); 134 // } else { 135 // memset(buffer, 0, hid_dev->input_report_size); 136 // } 128 /*! @todo This should probably be somehow atomic. */ 137 129 memcpy(buffer, hid_dev->input_report, 138 130 hid_dev->input_report_size); … … 140 132 *event_nr = usb_hid_report_number(hid_dev); 141 133 142 // clear the buffer so that it will not be received twice143 //memset(hid_dev->input_report, 0, hid_dev->input_report_size);144 145 // note that we already received this report146 // report_received = true;147 134 usb_log_debug2("OK\n"); 148 135 … … 184 171 185 172 if (hid_dev->report_desc_size > size) { 186 return EINVAL; // TODO: other error code173 return EINVAL; 187 174 } 188 175 -
uspace/drv/usbhid/kbd/kbddev.c
rbe8d907 r06f9d8fb 72 72 static const unsigned DEFAULT_ACTIVE_MODS = KM_NUM_LOCK; 73 73 74 ///** Boot protocol report size (key part). */75 //static const size_t BOOTP_REPORT_SIZE = 6;76 77 ///** Boot protocol total report size. */78 //static const size_t BOOTP_BUFFER_SIZE = 8;79 80 ///** Boot protocol output report size. */81 //static const size_t BOOTP_BUFFER_OUT_SIZE = 1;82 83 ///** Boot protocol error key code. */84 //static const uint8_t BOOTP_ERROR_ROLLOVER = 1;85 74 static const uint8_t ERROR_ROLLOVER = 1; 86 75 … … 105 94 .flags = 0 106 95 }; 107 108 //static usb_endpoint_description_t hid_poll_endpoint_description = {109 // .transfer_type = USB_TRANSFER_INTERRUPT,110 // .direction = USB_DIRECTION_IN,111 // .interface_class = USB_CLASS_HID,112 // .flags = 0113 //};114 115 ///* Array of endpoints expected on the device, NULL terminated. */116 //usb_endpoint_description_t117 // *usb_kbd_endpoints[USB_KBD_POLL_EP_COUNT + 1] = {118 // &boot_poll_endpoint_description,119 // &hid_poll_endpoint_description,120 // NULL121 //};122 96 123 97 const char *HID_KBD_FUN_NAME = "keyboard"; … … 176 150 177 151 /*----------------------------------------------------------------------------*/ 178 179 //static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count,180 // uint8_t report_id, void *arg);181 182 //static const usb_hid_report_in_callbacks_t usb_kbd_parser_callbacks = {183 // .keyboard = usb_kbd_process_keycodes184 //};185 186 /*----------------------------------------------------------------------------*/187 152 /* Keyboard layouts */ 188 153 /*----------------------------------------------------------------------------*/ … … 200 165 201 166 /*----------------------------------------------------------------------------*/ 202 /* Modifier constants */203 /*----------------------------------------------------------------------------*/204 /** Mapping of USB modifier key codes to generic modifier key codes. */205 //static const keycode_t usbhid_modifiers_keycodes[USB_HID_MOD_COUNT] = {206 // KC_LCTRL, /* USB_HID_MOD_LCTRL */207 // KC_LSHIFT, /* USB_HID_MOD_LSHIFT */208 // KC_LALT, /* USB_HID_MOD_LALT */209 // 0, /* USB_HID_MOD_LGUI */210 // KC_RCTRL, /* USB_HID_MOD_RCTRL */211 // KC_RSHIFT, /* USB_HID_MOD_RSHIFT */212 // KC_RALT, /* USB_HID_MOD_RALT */213 // 0, /* USB_HID_MOD_RGUI */214 //};215 216 //typedef enum usbhid_lock_code {217 // USB_KBD_LOCK_NUM = 0x53,218 // USB_KBD_LOCK_CAPS = 0x39,219 // USB_KBD_LOCK_SCROLL = 0x47,220 // USB_KBD_LOCK_COUNT = 3221 //} usbhid_lock_code;222 223 //static const usbhid_lock_code usbhid_lock_codes[USB_KBD_LOCK_COUNT] = {224 // USB_KBD_LOCK_NUM,225 // USB_KBD_LOCK_CAPS,226 // USB_KBD_LOCK_SCROLL227 //};228 229 /*----------------------------------------------------------------------------*/230 167 /* IPC method handler */ 231 168 /*----------------------------------------------------------------------------*/ 232 169 233 170 static void default_connection_handler(ddf_fun_t *, ipc_callid_t, ipc_call_t *); 234 //ddf_dev_ops_t keyboard_ops = {235 // .default_handler = default_connection_handler236 //};237 171 238 172 /** … … 301 235 return; 302 236 } 303 237 304 238 /* Reset the LED data. */ 305 239 memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t)); … … 495 429 */ 496 430 static void usb_kbd_check_key_changes(usb_hid_dev_t *hid_dev, 497 usb_kbd_t *kbd_dev /*, const uint8_t *key_codes, size_t count*/)431 usb_kbd_t *kbd_dev) 498 432 { 499 433 unsigned int key; … … 567 501 } 568 502 569 // usb_log_debug("Old keys: ");570 // for (i = 0; i < kbd_dev->key_count; ++i) {571 // usb_log_debug("%d ", kbd_dev->keys_old[i]);572 // }573 // usb_log_debug("\n");574 575 576 // usb_log_debug("New keys: ");577 // for (i = 0; i < kbd_dev->key_count; ++i) {578 // usb_log_debug("%d ", kbd_dev->keys[i]);579 // }580 // usb_log_debug("\n");581 582 503 memcpy(kbd_dev->keys_old, kbd_dev->keys, kbd_dev->key_count * 4); 583 504 … … 590 511 591 512 /*----------------------------------------------------------------------------*/ 592 /* Callbacks for parser */593 /*----------------------------------------------------------------------------*/594 /**595 * Callback function for the HID report parser.596 *597 * This function is called by the HID report parser with the parsed report.598 * The parsed report is used to check if any events occured (key was pressed or599 * released, modifier was pressed or released).600 *601 * @param key_codes Parsed keyboard report - codes of currently pressed keys602 * according to HID Usage Tables.603 * @param count Number of key codes in report (size of the report).604 * @param report_id605 * @param arg User-specified argument. Expects pointer to the keyboard device606 * structure representing the keyboard.607 *608 * @sa usb_kbd_check_key_changes(), usb_kbd_check_modifier_changes()609 */610 //static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count,611 // uint8_t report_id, void *arg)612 //{613 // if (arg == NULL) {614 // usb_log_warning("Missing argument in callback "615 // "usbhid_process_keycodes().\n");616 // return;617 // }618 619 // usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg;620 621 // if (hid_dev->data == NULL) {622 // usb_log_warning("Missing KBD device structure in callback.\n");623 // return;624 // }625 626 // usb_kbd_t *kbd_dev = (usb_kbd_t *)hid_dev->data;627 628 // usb_log_debug("Got keys from parser (report id: %u): %s\n",629 // report_id, usb_debug_str_buffer(key_codes, count, 0));630 631 // if (count != kbd_dev->key_count) {632 // usb_log_warning("Number of received keycodes (%zu) differs from"633 // " expected (%zu).\n", count, kbd_dev->key_count);634 // return;635 // }636 637 // ///usb_kbd_check_modifier_changes(kbd_dev, key_codes, count);638 // usb_kbd_check_key_changes(hid_dev, kbd_dev, key_codes, count);639 //}640 641 /*----------------------------------------------------------------------------*/642 513 /* General kbd functions */ 643 514 /*----------------------------------------------------------------------------*/ … … 668 539 "buffer %s\n", usb_debug_str_buffer(buffer, actual_size, 0)); 669 540 670 // int rc = usb_hid_boot_keyboard_input_report(buffer, actual_size,671 // callbacks, kbd_dev);672 541 usb_hid_report_path_t *path = usb_hid_report_path(); 673 542 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 674 //usb_hid_report_path_set_report_id(path, 0);675 543 676 544 uint8_t report_id; … … 698 566 699 567 assert(i < kbd_dev->key_count); 700 // if (i == kbd_dev->key_count) {701 // break;702 // }703 568 704 569 // save the key usage 705 /* TODO: maybe it's not good to save value, nor usage706 * as the value may be e.g. 1 for LEDs and usage may be707 * value of the LED. On the other hand, in case of normal708 * keys, the usage is more important and we must check709 * that. One possible solution: distinguish between those710 * two parts of the Report somehow.711 */712 570 if (field->value != 0) { 713 571 kbd_dev->keys[i] = field->usage; … … 896 754 usb_log_warning("Error creating output report buffer.\n"); 897 755 free(kbd_dev->keys); 898 return ENOMEM; /* TODO: other error code */756 return ENOMEM; 899 757 } 900 758 … … 951 809 952 810 // save the KBD device structure into the HID device structure 953 //hid_dev->data = kbd_dev;954 811 *data = kbd_dev; 955 812 … … 1038 895 1039 896 if ((*kbd_dev)->repeat_mtx != NULL) { 1040 / * TODO: replace by some check and wait */1041 assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx));897 //assert(!fibril_mutex_is_locked((*kbd_dev)->repeat_mtx)); 898 while (fibril_mutex_is_locked((*kbd_dev)->repeat_mtx)) {} 1042 899 free((*kbd_dev)->repeat_mtx); 1043 900 } -
uspace/drv/usbhid/kbd/main.c
rbe8d907 r06f9d8fb 131 131 "Could not add DDF function to class 'keyboard': %s.\n", 132 132 str_error(rc)); 133 // TODO: Can / should I destroy the DDF function?134 133 ddf_fun_destroy(kbd_fun); 135 134 usb_kbd_free(&kbd_dev); 136 135 return rc; 137 136 } 138 139 /*140 * Create new fibril for handling this keyboard141 */142 //fid_t fid = fibril_create(usb_kbd_fibril, kbd_dev);143 137 144 138 /* Start automated polling function. … … 164 158 return rc; 165 159 } 166 //fibril_add_ready(fid);167 160 168 161 /* -
uspace/drv/usbhid/mouse/mousedev.c
rbe8d907 r06f9d8fb 394 394 395 395 fun->ops = &mouse->ops; 396 fun->driver_data = mouse; // TODO: maybe change to hid_dev->data396 fun->driver_data = mouse; 397 397 398 398 int rc = ddf_fun_bind(fun); … … 432 432 */ 433 433 fun->ops = &mouse->ops; 434 fun->driver_data = mouse; // TODO: maybe change to hid_dev->data434 fun->driver_data = mouse; 435 435 436 436 rc = ddf_fun_bind(fun); … … 488 488 489 489 // set handler for incoming calls 490 // TODO: must be one for each subdriver!!491 490 mouse_dev->ops.default_handler = default_connection_handler; 492 491 493 492 // TODO: how to know if the device supports the request??? 494 //usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe,495 //hid_dev->usb_dev->interface_no, IDLE_RATE);493 usbhid_req_set_idle(&hid_dev->usb_dev->ctrl_pipe, 494 hid_dev->usb_dev->interface_no, IDLE_RATE); 496 495 497 496 int rc = usb_mouse_create_function(hid_dev, mouse_dev); -
uspace/drv/usbhid/mouse/mousedev.h
rbe8d907 r06f9d8fb 45 45 /** Container for USB mouse device. */ 46 46 typedef struct { 47 ///** Polling interval in microseconds. */48 //suseconds_t poll_interval_us;49 47 /** IPC phone to console (consumer). */ 50 48 int mouse_phone; -
uspace/drv/usbhid/multimedia/multimedia.c
rbe8d907 r06f9d8fb 143 143 assert(multim_dev != NULL); 144 144 145 // usb_multimedia_t *multim_dev = (usb_multimedia_t *)hid_dev->data;146 147 145 console_event_t ev; 148 146 … … 173 171 // hangup phone to the console 174 172 async_hangup((*multim_dev)->console_phone); 175 176 // free all buffers177 // if ((*multim_dev)->keys != NULL) {178 // free((*multim_dev)->keys);179 // }180 // if ((*multim_dev)->keys_old != NULL) {181 // free((*multim_dev)->keys_old);182 // }183 173 184 174 free(*multim_dev); … … 245 235 multim_dev->console_phone = -1; 246 236 247 // usb_hid_report_path_t *path = usb_hid_report_path();248 // usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_CONSUMER, 0);249 250 // usb_hid_report_path_set_report_id(path, 1);251 252 // multim_dev->key_count = usb_hid_report_size(253 // hid_dev->report, 1, USB_HID_REPORT_TYPE_INPUT);254 255 // usb_hid_report_path_free(path);256 257 // usb_log_debug(NAME " Size of the input report: %zu\n",258 // multim_dev->key_count);259 260 // multim_dev->keys = (int32_t *)calloc(multim_dev->key_count,261 // sizeof(int32_t));262 263 // if (multim_dev->keys == NULL) {264 // usb_log_fatal("No memory!\n");265 // free(multim_dev);266 // return ENOMEM;267 // }268 269 // multim_dev->keys_old =270 // (int32_t *)calloc(multim_dev->key_count, sizeof(int32_t));271 272 // if (multim_dev->keys_old == NULL) {273 // usb_log_fatal("No memory!\n");274 // free(multim_dev->keys);275 // free(multim_dev);276 // return ENOMEM;277 // }278 279 237 /*! @todo Autorepeat */ 280 238 … … 315 273 { 316 274 // TODO: checks 275 if (hid_dev == NULL || data == NULL || buffer == NULL) { 276 return false; 277 } 317 278 318 279 usb_log_debug(NAME " usb_lgtch_polling_callback(%p, %p, %zu)\n", 319 280 hid_dev, buffer, buffer_size); 320 321 if (data == NULL) {322 return EINVAL; // TODO: other error code?323 }324 281 325 282 usb_multimedia_t *multim_dev = (usb_multimedia_t *)data; … … 348 305 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 349 306 USB_HID_REPORT_TYPE_INPUT); 350 351 // unsigned int key; 352 307 353 308 /*! @todo Is this iterating OK if done multiple times? 354 309 * @todo The parsing is not OK -
uspace/drv/usbhid/subdrivers.c
rbe8d907 r06f9d8fb 58 58 }; 59 59 60 //static usb_hid_subdriver_usage_t generic_hid_key_path[] = {61 // {0, 0}62 //};63 64 60 const usb_hid_subdriver_mapping_t usb_hid_subdrivers[] = { 65 61 { … … 103 99 } 104 100 }, 105 // {106 // generic_hid_key_path,107 // 0,108 // USB_HID_PATH_COMPARE_ANYWHERE,109 // -1,110 // -1,111 // {112 // .init = usb_generic_hid_init,113 // .deinit = NULL,114 // .poll = usb_generic_hid_polling_callback,115 // .poll_end = NULL116 // }117 // },118 101 {NULL, -1, 0, -1, -1, {NULL, NULL, NULL, NULL, NULL}} 119 102 }; -
uspace/drv/usbhid/usbhid.c
rbe8d907 r06f9d8fb 63 63 static const int USB_HID_MAX_SUBDRIVERS = 10; 64 64 65 /** @todo What happens if this is not fibril local? */66 //static fibril_local bool report_number;67 68 65 /*----------------------------------------------------------------------------*/ 69 66 … … 206 203 } 207 204 208 // if (mapping->report_id >= 0) {209 // usb_hid_report_path_set_report_id(usage_path,210 // mapping->report_id);211 // }212 213 205 assert(hid_dev->report != NULL); 214 206 215 207 usb_log_debug("Compare flags: %d\n", mapping->compare); 216 // size_t size = usb_hid_report_size(hid_dev->report, 0,217 // USB_HID_REPORT_TYPE_INPUT);218 // size_t size = 0;219 208 220 209 bool matches = false; 221 222 // usb_hid_report_description_t *report_des =223 // usb_hid_report_find_description(hid_dev->report,224 // mapping->report_id, USB_HID_REPORT_TYPE_INPUT);225 210 uint8_t report_id = mapping->report_id; 226 211 227 /*while(report_des != NULL)*/do { 228 229 // if((mapping->report_id) == 0 && (report_des->report_id != 0)) { 230 // usb_hid_report_path_set_report_id(usage_path, 231 // report_des->report_id); 232 // } 233 212 do { 234 213 usb_log_debug("Trying report id %u\n", report_id); 235 214 … … 247 226 248 227 if (field != NULL) { 249 // size++;250 // field = usb_hid_report_get_sibling(hid_dev->report,251 // field, usage_path, mapping->compare,252 // USB_HID_REPORT_TYPE_INPUT);253 228 matches = true; 254 229 break; … … 258 233 hid_dev->report, report_id, 259 234 USB_HID_REPORT_TYPE_INPUT); 260 261 // if((mapping->report_id == 0) && (report_des->report_id != 0)) {262 // uint8_t report_id = usb_hid_get_next_report_id(263 // hid_dev->report, report_des->report_id,264 // USB_HID_REPORT_TYPE_INPUT);265 266 // if(report_id == 0) {267 // break;268 // }269 270 // report_des = usb_hid_report_find_description(271 // hid_dev->report, report_id,272 // USB_HID_REPORT_TYPE_INPUT);273 // }274 // else {275 // break;276 // }277 235 } while (!matches && report_id != 0); 278 236 279 // usb_log_debug("Size of the input report: %zu\n", size);280 237 usb_hid_report_path_free(usage_path); 281 238 … … 423 380 424 381 uint8_t report_id = 0; 425 size_t size;/* = usb_hid_report_byte_size(hid_dev->report, report_id, 426 USB_HID_REPORT_TYPE_INPUT);*/ 382 size_t size; 427 383 428 384 size_t max_size = 0; … … 503 459 rc = usb_hid_check_pipes(hid_dev, dev); 504 460 if (rc != EOK) { 505 //usb_hid_free(&hid_dev);506 461 return rc; 507 462 } … … 551 506 == USB_HID_GENERIC_POLL_EP_NO); 552 507 553 /* TODO: this has no meaning if the report descriptor554 is not parsed */555 508 usb_log_info("Falling back to generic HID driver.\n"); 556 509 rc = usb_hid_set_generic_hid_subdriver(hid_dev); … … 563 516 usb_log_debug("Subdriver count: %d\n", 564 517 hid_dev->subdriver_count); 565 //usb_hid_free(&hid_dev);566 518 567 519 } else { … … 619 571 usb_hid_dev_t *hid_dev = (usb_hid_dev_t *)arg; 620 572 621 // int allocated = (hid_dev->input_report != NULL);622 573 assert(hid_dev->input_report != NULL); 623 574 usb_log_debug("Max input report size: %zu, buffer size: %zu\n", 624 575 hid_dev->max_input_report_size, buffer_size); 625 //assert(hid_dev->max_input_report_size >= buffer_size); 576 626 577 if (hid_dev->max_input_report_size >= buffer_size) { 627 578 /*! @todo This should probably be atomic. */ … … 670 621 /*----------------------------------------------------------------------------*/ 671 622 672 //const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev)673 //{674 // switch (hid_dev->poll_pipe_index) {675 // case USB_HID_KBD_POLL_EP_NO:676 // return HID_KBD_FUN_NAME;677 // break;678 // case USB_HID_MOUSE_POLL_EP_NO:679 // return HID_MOUSE_FUN_NAME;680 // break;681 // default:682 // return HID_GENERIC_FUN_NAME;683 // }684 //}685 686 /*----------------------------------------------------------------------------*/687 688 //const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev)689 //{690 // // this means that only boot protocol keyboards will be connected691 // // to the console; there is probably no better way to do this692 693 // switch (hid_dev->poll_pipe_index) {694 // case USB_HID_KBD_POLL_EP_NO:695 // return HID_KBD_CLASS_NAME;696 // break;697 // case USB_HID_MOUSE_POLL_EP_NO:698 // return HID_MOUSE_CLASS_NAME;699 // break;700 // default:701 // return HID_GENERIC_CLASS_NAME;702 // }703 //}704 705 /*----------------------------------------------------------------------------*/706 707 623 void usb_hid_new_report(usb_hid_dev_t *hid_dev) 708 624 { … … 716 632 return hid_dev->report_nr; 717 633 } 718 719 /*----------------------------------------------------------------------------*/720 721 //void usb_hid_report_received(void)722 //{723 // ++report_number;724 //}725 726 /*----------------------------------------------------------------------------*/727 728 //bool usb_hid_report_ready(void)729 //{730 // return !report_received;731 //}732 634 733 635 /*----------------------------------------------------------------------------*/ -
uspace/drv/usbhid/usbhid.h
rbe8d907 r06f9d8fb 55 55 bool reason); 56 56 57 // TODO: add function and class name??58 57 typedef struct usb_hid_subdriver { 59 58 /** Function to be called when initializing HID device. */ … … 126 125 void *arg); 127 126 128 //const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev);129 130 //const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev);131 132 127 void usb_hid_new_report(usb_hid_dev_t *hid_dev); 133 128 134 129 int usb_hid_report_number(usb_hid_dev_t *hid_dev); 135 136 //void usb_hid_report_received(void);137 138 //bool usb_hid_report_ready(void);139 130 140 131 void usb_hid_free(usb_hid_dev_t **hid_dev); -
uspace/srv/hid/console/console.c
rbe8d907 r06f9d8fb 768 768 769 769 int phone = fd_phone(fd); 770 close(fd); 770 771 if (phone < 0) { 771 772 printf(NAME ": Failed to connect to input device\n"); … … 777 778 handler, &hash); 778 779 if (rc != EOK) { 780 async_hangup(phone); 779 781 printf(NAME ": " \ 780 782 "Failed to create callback from input device: %s.\n",
Note:
See TracChangeset
for help on using the changeset viewer.