Changeset 90df90c in mainline
- Timestamp:
- 2011-11-09T13:23:03Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 07b9cbae
- Parents:
- 6f730278
- Location:
- uspace/drv/bus/usb/usbhid
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/main.c
r6f730278 r90df90c 73 73 usb_device_data_alloc(dev, sizeof(usb_hid_dev_t)); 74 74 if (hid_dev == NULL) { 75 usb_log_error("Error while creating USB/HID device " 76 "structure.\n"); 75 usb_log_error("Failed to create USB/HID device structure.\n"); 77 76 return ENOMEM; 78 77 } … … 87 86 usb_log_debug("USB/HID device structure initialized.\n"); 88 87 89 /*90 * 1) subdriver vytvori vlastnu ddf_fun, vlastne ddf_dev_ops, ktore da91 * do nej.92 * 2) do tych ops do .interfaces[DEV_IFACE_USBHID (asi)] priradi93 * vyplnenu strukturu usbhid_iface_t.94 * 3) klientska aplikacia - musi si rucne vytvorit telefon95 * (devman_device_connect() - cesta k zariadeniu (/hw/pci0/...) az96 * k tej fcii.97 * pouzit usb/classes/hid/iface.h - prvy int je telefon98 */99 100 88 /* Start automated polling function. 101 89 * This will create a separate fibril that will query the device 102 * for the data continuously. 103 */ 90 * for the data continuously. */ 104 91 rc = usb_device_auto_poll(dev, 105 92 /* Index of the polling pipe. */ … … 135 122 static int usb_hid_device_rem(usb_device_t *dev) 136 123 { 137 // TODO: Stop device polling fibril 138 // TODO: Stop autorepeat fibril 139 // TODO: Call deinit 124 // TODO: Stop device polling 125 // TODO: Call deinit (stops autorepeat too) 140 126 return ENOTSUP; 141 127 } -
uspace/drv/bus/usb/usbhid/usbhid.c
r6f730278 r90df90c 128 128 return (hid_dev->usb_dev->descriptors.device.vendor_id 129 129 == mapping->vendor_id 130 && hid_dev->usb_dev->descriptors.device.product_id 130 && hid_dev->usb_dev->descriptors.device.product_id 131 131 == mapping->product_id); 132 132 } … … 301 301 assert(dev); 302 302 303 if (dev->pipes[USB_HID_KBD_POLL_EP_NO].present) { 304 usb_log_debug("Found keyboard endpoint.\n"); 305 // save the pipe index 306 hid_dev->poll_pipe_index = USB_HID_KBD_POLL_EP_NO; 307 } else if (dev->pipes[USB_HID_MOUSE_POLL_EP_NO].present) { 308 usb_log_debug("Found mouse endpoint.\n"); 309 // save the pipe index 310 hid_dev->poll_pipe_index = USB_HID_MOUSE_POLL_EP_NO; 311 } else if (dev->pipes[USB_HID_GENERIC_POLL_EP_NO].present) { 312 usb_log_debug("Found generic HID endpoint.\n"); 313 // save the pipe index 314 hid_dev->poll_pipe_index = USB_HID_GENERIC_POLL_EP_NO; 315 } else { 316 usb_log_error("None of supported endpoints found - probably" 317 " not a supported device.\n"); 318 return ENOTSUP; 319 } 320 321 return EOK; 303 static const struct { 304 unsigned ep_number; 305 const char* description; 306 } endpoints[] = { 307 {USB_HID_KBD_POLL_EP_NO, "Keyboard endpoint"}, 308 {USB_HID_MOUSE_POLL_EP_NO, "Mouse endpoint"}, 309 {USB_HID_GENERIC_POLL_EP_NO, "Generic HID endpoint"}, 310 }; 311 312 for (unsigned i = 0; i < sizeof(endpoints)/sizeof(endpoints[0]); ++i) { 313 if (endpoints[i].ep_number >= dev->pipes_count) { 314 return EINVAL; 315 } 316 if (dev->pipes[endpoints[i].ep_number].present) { 317 usb_log_debug("Found: %s.\n", endpoints[i].description); 318 hid_dev->poll_pipe_index = endpoints[i].ep_number; 319 return EOK; 320 } 321 } 322 return ENOTSUP; 322 323 } 323 324 … … 395 396 rc = usb_hid_process_report_descriptor(hid_dev->usb_dev, 396 397 &hid_dev->report, &hid_dev->report_desc, &hid_dev->report_desc_size); 398 399 /* 400 * 1) subdriver vytvori vlastnu ddf_fun, vlastne ddf_dev_ops, ktore da 401 * do nej. 402 * 2) do tych ops do .interfaces[DEV_IFACE_USBHID (asi)] priradi 403 * vyplnenu strukturu usbhid_iface_t. 404 * 3) klientska aplikacia - musi si rucne vytvorit telefon 405 * (devman_device_connect() - cesta k zariadeniu (/hw/pci0/...) az 406 * k tej fcii. 407 * pouzit usb/classes/hid/iface.h - prvy int je telefon 408 */ 397 409 398 410 bool fallback = false;
Note:
See TracChangeset
for help on using the changeset viewer.