Changes in uspace/lib/usb/src/hcdrv.c [1f43c8f:fe5e00d6] in mainline
- File:
-
- 1 edited
-
uspace/lib/usb/src/hcdrv.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/hcdrv.c
r1f43c8f rfe5e00d6 54 54 }; 55 55 56 static usb_hc_device_t *usb_hc_device_create(device_t *dev) { 56 int usb_add_hc_device(device_t *dev) 57 { 57 58 usb_hc_device_t *hc_dev = malloc(sizeof (usb_hc_device_t)); 58 59 59 list_initialize(&hc_dev->link); 60 list_initialize(&hc_dev->hubs);61 list_initialize(&hc_dev->attached_devices);62 60 hc_dev->transfer_ops = NULL; 63 61 … … 65 63 dev->ops = &usb_device_ops; 66 64 hc_dev->generic->driver_data = hc_dev; 67 68 return hc_dev;69 }70 71 int usb_add_hc_device(device_t *dev)72 {73 usb_hc_device_t *hc_dev = usb_hc_device_create(dev);74 65 75 66 int rc = hc_driver->add_hc(hc_dev); … … 87 78 list_append(&hc_dev->link, &hc_list); 88 79 80 //add keyboard 81 /// @TODO this is not correct code 82 89 83 /* 90 * FIXME: the following is a workaround to force loading of USB 91 * keyboard driver. 92 * Will be removed as soon as the hub driver is completed and 93 * can detect connected devices. 84 * Announce presence of child device. 94 85 */ 95 printf("%s: trying to add USB HID child device...\n", hc_driver->name); 96 rc = usb_hc_add_child_device(dev, USB_KBD_DEVICE_NAME, "usb&hid", false); 97 if (rc != EOK) { 98 printf("%s: adding USB HID child failed...\n", hc_driver->name); 86 device_t *kbd = NULL; 87 match_id_t *match_id = NULL; 88 89 kbd = create_device(); 90 if (kbd == NULL) { 91 printf("ERROR: enomem\n"); 92 } 93 kbd->name = USB_KBD_DEVICE_NAME; 94 95 match_id = create_match_id(); 96 if (match_id == NULL) { 97 printf("ERROR: enomem\n"); 99 98 } 100 99 100 char *id; 101 rc = asprintf(&id, USB_KBD_DEVICE_NAME); 102 if (rc <= 0) { 103 printf("ERROR: enomem\n"); 104 return rc; 105 } 106 107 match_id->id = id; 108 match_id->score = 30; 109 110 add_match_id(&kbd->match_ids, match_id); 111 112 rc = child_device_register(kbd, dev); 113 if (rc != EOK) { 114 printf("ERROR: cannot register kbd\n"); 115 return rc; 116 } 117 118 printf("%s: registered root hub\n", dev->name); 101 119 return EOK; 102 120 }
Note:
See TracChangeset
for help on using the changeset viewer.
