int dbgp_probe_gadget(struct ehci_dbg_port *ehci_debug, struct dbgp_pipe *pipe) { int ret; if (CONFIG_USBDEBUG_OPTIONAL_HUB_PORT != 0) { ret = dbgp_hub_enable(ehci_debug, USB_DEBUG_DEVNUM-1, CONFIG_USBDEBUG_OPTIONAL_HUB_PORT); if (ret < 0) { printk(BIOS_INFO, "Could not enable USB hub on debug port.\n"); return ret; } } if (IS_ENABLED(CONFIG_USBDEBUG_DONGLE_FTDI_FT232H)) { ret = probe_for_ftdi(ehci_debug, pipe); } else { ret = probe_for_debug_descriptor(ehci_debug, pipe); } if (ret < 0) { dprintk(BIOS_INFO, "Could not enable debug dongle.\n"); return ret; } activate_endpoints(pipe); return 0; }
int usb_set_config(int cfn) { if (usb_get_state()!=USB_STATE_ADDRESS&&usb_get_state()!=USB_STATE_CONFIGURED) return -1; if (!cfn) { flags.config=0; usb_set_state(USB_STATE_ADDRESS); } else { if (usb_get_state()==USB_STATE_CONFIGURED) { if (flags.config==cfn) return 0; } if (!usb_have_config(cfn)) return -1; flags.config=cfn; if (activate_endpoints(cfn)) return -1; usb_set_state(USB_STATE_CONFIGURED); } return 0; }