On the J6, I'm trying to do a USB role switch (host -> device) from the USB 2.0 port and create a USB Gadget with multiple interfaces but running into a few problems.
When I plug a iPhone using the USB 2.0 port using the Male Mini-B to Female Standard A USB Adapter, The J6 acts as a host and correctly detects the smartphone and shows a relevant popup to choose how to connect to the phone. So the "host" part works fine.
I am tring to do a role switch so the J6 is not a "device" and would like to create a gadget (or a slave) that has a configuration with following interfaces.
- Custom Bulk IN/OUT
- USB NCM control interface
- USB NCM data interface
Now the OS seems to be configured to use 'configfs' but I cannot 'mkdir' under '/config/usb_gadget' as it results in the following error.
> kobject_add_internal failed for android0 with -EEXIST, don't try to register things with the same name in the same directory.
Also there is a '/config/usb_gadget/g1' already which is for the USB 3.0 port.
So there are multiple issues involved getting this to work so here are my questions:
Q1) Can role switch be done programmatically, aside from using the shell to write to the 'mode' file?
Q2) How can I add an additional gadget (for the USB 2.0 port) using 'configfs' (mkdir fails currently)?
Q2) How do I add support for NCM so that can be used in the new USB gadget that will be created.
Thanks,
Alan