Lines Matching defs:hub

56         USB_DEBUG("WARNING: hub intr transfer failed...\n");
66 struct usb_device *usb_hub_get_device(struct usb_hub *hub,
69 return (hub->device->controller->devices[port->device_index]);
73 * \brief checks if the hub device lies within an acceptable depdth, such that
107 * \param hub the hub to attach the device
113 static usb_error_t usb_hub_reattach_port(struct usb_hub *hub, uint8_t portno)
119 struct usb_device *child = usb_hub_get_device(hub,
120 hub->ports + (portno - 1));
124 err = usb_hub_clear_port_feature(hub->device,
130 err = usb_hub_get_port_status(hub->device, portno, &ps);
138 hub->device->device_address, portno);
155 err = usb_hub_clear_port_feature(hub->device,
160 err = usb_hub_reset_port(hub->device, portno);
166 err = usb_hub_get_port_status(hub->device, portno, &ps);
184 * figuring out the device speed, this depends on the hub speed
187 usb_speed_t speed = hub->device->speed;
188 switch (hub->device->speed) {
234 hub->device->device_address, portno);
235 child = usb_device_alloc(hub->device->controller, hub->device,
236 hub->device->depth + 1, portno - 1, portno, speed, mode);
254 err = usb_hub_clear_port_feature(hub->device,
264 static usb_error_t usb_hub_suspend_resume_port(struct usb_hub *hub,
272 * \brief initializes a new USB hub device and checks for attached devices
274 * \param hub_device the USB device which is a hub
286 USB_DEBUG_DEV("initializing hub device...\n");
288 /* check if the hub has an appropriate depth */
317 USB_DEBUG("ERROR: could not get hub descriptor \n");
340 debug_printf("ERROR: could not get hub descriptor \n");
360 USB_DEBUG_DEV("Found hub device: Num ports = %u\n", desc.bNbrPorts);
363 debug_printf("ERROR: hub has no ports\n");
368 struct usb_hub *hub = malloc(
371 if (hub == NULL) {
372 debug_printf("ERROR: Could not allocate memory for hub struct\n");
377 hub_device->hub = hub;
378 hub->device = hub_device;
380 hub->num_ports = nports;
383 hub->portpower = USB_POWER_MAX;
385 hub->portpower = USB_POWER_MIN;
391 * the root hub is special, it needs no interrupt transfer
393 USB_DEBUG_DEV("device was the root hub \n");
396 USB_DEBUG_DEV("device was an attached hub \n");
397 err = usb_transfer_setup(hub_device, 0, &hub->xfers[0], hub_config);
401 free(hub);
412 struct usb_hub_port *port = hub->ports + portindex;
453 if (hub->xfers[0] != NULL) {
454 USB_DEBUG_DEV("starting hub interrupt transfer\n");
455 usb_transfer_start(hub->xfers[0]);
462 * \brief this function is called upon removal of the USB hub device.
465 * \brief hub_device the USB device (hub) which is removed
476 * \brief this function is called when a port hub change event is detected.
479 * \param usb_device the hub to explore
488 struct usb_hub *hub = hub_device->hub;
492 if (hub == NULL) {
498 * if the USB hub is too deep in the USB device tree, then the attached
514 "exploring ports of hub [%03u]...\n", hub_device->device_address);
516 for (uint32_t i = 0; i < hub->num_ports; i++) {
517 port = hub->ports + i;
520 err = usb_hub_get_port_status(hub->device, portno, &ps);
531 err = usb_hub_clear_port_feature(hub->device,
546 err = usb_hub_clear_port_feature(hub->device,
572 err = usb_hub_reattach_port(hub, portno);
581 err = usb_hub_suspend_resume_port(hub, portno);
591 if (child != NULL && child->hub != NULL) {
592 USB_DEBUG_DEV("Device on port %u is a hub. Exploring...\n", portno);
641 struct usb_hub *hub = dev->parent_hs_hub->hub;
642 assert(hub != NULL);
653 slot = usb_hub_find_slot(hub->uframe_usage, 4, 6, mask);
658 hub->uframe_usage[cs] += length;
665 slot = usb_hub_find_slot(hub->uframe_usage, 8, 6, mask);
775 usb_error_t usb_hub_query_info(struct usb_hub *hub, uint8_t *ret_nports,
784 switch (hub->device->speed) {
788 err = usb_hub_get_hub_descriptor(hub->device, 1, &desc);
790 debug_printf("ERROR: Failed to get hub descriptor\n");
797 if (hub->device->speed == USB_SPEED_HIGH) {
802 assert(!"NYI: super speed hub\n");
827 debug_printf("WARNING: No root hub\n");