allend |
07-27-2021 10:47 AM |
I have been looking at commit 34ada7b357dda19b32a1c440512da5367621be20 in ChangeLog-5.13.4 , which has also been backported into the 5.12.19 kernel. (Thanks Marav!)
I am no expert, but the way I read the code,
Code:
if (gadget_is_otg(gadget) && !otg_desc[0]) {
struct usb_descriptor_header *usb_desc;
usb_desc = usb_otg_descriptor_alloc(gadget);
if (!usb_desc) {
status = -ENOMEM;
goto put;
}
usb_otg_descriptor_init(gadget, usb_desc);
otg_desc[0] = usb_desc;
otg_desc[1] = NULL;
}
/* register our configuration */
status = usb_add_config(cdev, &config_driver, do_config);
if (status < 0)
goto free_otg_desc;
usb_composite_overwrite_options(cdev, &coverwrite);
dev_info(&gadget->dev, DRIVER_DESC ", version: " DRIVER_VERSION "\n");
return 0;
free_otg_desc:
kfree(otg_desc[0]);
otg_desc[0] = NULL;
put:
list_for_each_entry(m, &hidg_func_list, node) {
if (m == n)
break;
usb_put_function_instance(m->fi);
}
return status;
}
if the test is passed, then it is possible to skip over the usb configuration if USB On-The-Go capability is detected.
The gadget_is_otg() is defined in /include/linux/usb/gadget.h
Code:
/**
* gadget_is_otg - return true iff the hardware is OTG-ready
* @g: controller that might have a Mini-AB connector
*
* This is a runtime test, since kernels with a USB-OTG stack sometimes
* run on boards which only have a Mini-B (or Mini-A) connector.
*/
static inline int gadget_is_otg(struct usb_gadget *g)
{
#ifdef CONFIG_USB_OTG
return g->is_otg;
#else
return 0;
#endif
}
In the Slackware64 kernel 5.13.4 and 5.13.5 there is
Quote:
bash-5.1$ grep CONFIG_USB_OTG /usr/src/linux/.config
CONFIG_USB_OTG=y
# CONFIG_USB_OTG_PRODUCTLIST is not set
# CONFIG_USB_OTG_DISABLE_EXTERNAL_HUB is not set
# CONFIG_USB_OTG_FSM is not set
|
I do not have hardware to test this, but my suggestion is to either try reversing that commit or perhaps disabling the .config setting.
|