usb-ctrl: add a way to mount composite gdts

The usb-vhub has a limited number of usb-gadget ports. The BMC features
might want to attach usb-device count greater than the aspeed-vhub
contains ports. One of the ways to solve the issue could be by attaching
usb-gadget functions to a composite usb interface.

The change brings a way to mount mass_storage and cdc-based devices
under composite device configuration (VID/PID: 1D6B:0104)

This make possible to mount bouth device functions under single
vhub-port.

Tested:
* Insert usb-gadget:mass-storage device is success:
  ```bash
  #: usb-ctrl insert usb0 /tmp/image.iso cdrom
  ```
* Insert usb-gadget:usb-ecm device for same port is success:
  ```bash
  #: usb-ctrl ecm usb0 on A0:C5:F2:15:B5:89 A0:C5:F2:15:B5:88
  ```
* the sysfs displays function-descriptors for both interfaces:
  ```bash
  #: root@vegman-r120-020323000A:~# cd /sys/kernel/config/usb_gadget
  #: root@vegman-r120-020323000A:~# ls -la ./usb0/functions/
     drwxr-xr-x 4 root root 0 Dec 14 12:13 .
     drwxr-xr-x 6 root root 0 Dec 14 12:14 ..
     drwxr-xr-x 2 root root 0 Dec 14 12:13 ecm.usb0
     drwxr-xr-x 3 root root 0 Dec 14 12:11 mass_storage.usb0
  ```
* eject one of the mounted device works properly, another one stay
  online:
  ```bash
  #: usb-ctrl ecm usb0 off
  #: ls -la /sys/kernel/config/usb_gadget/usb0/functions/
     drwxr-xr-x 3 root root 0 Dec 14 12:19 .
     drwxr-xr-x 6 root root 0 Dec 14 12:19 ..
     drwxr-xr-x 3 root root 0 Dec 14 12:11 mass_storage.usb0
  ```

* output on the host side
  ```bash
  #: root@ubuntu:/home/ubuntu# lsusb -d 1d6b:0104 -v

     Bus 001 Device 003: ID 1d6b:0104 Linux Foundation Multifunction ...
     Device Descriptor:
     ...
       idVendor 0x1d6b Linux Foundation
       idProduct 0x0104 Multifunction Composite Gadget
     ...
       Interface Descriptor:
       ...
            bInterfaceClass 8 Mass Storage
            bInterfaceSubClass 6 SCSI
            bInterfaceProtocol 80 Bulk-Only
            iInterface 5 Mass Storage
       ...
       Interface Descriptor:
       ...
            bInterfaceClass 2 Communications
            bInterfaceSubClass 6 Ethernet Networking
            bInterfaceProtocol 0
            iInterface 7 CDC Ethernet Control Model (ECM)
       ...

  ```

Change-Id: I6f54ac5c116ee0bb08e9d18c33267f5b401c2c00
Signed-off-by: Igor Kononenko <i.kononenko.e@gmail.com>
1 file changed
tree: b0de88bd611e1e8ac6cdb6ce82d8593e3f43cfa8
  1. firstboot/
  2. http-redirect/
  3. usb-ctrl/
  4. .gitignore
  5. LICENSE
  6. meson.build
  7. meson_options.txt
  8. OWNERS
  9. README.md
README.md

phosphor-misc

phosphor-misc is a collection of miscellaneous OpenBMC functions that doesn't really fit anywhere else.

Contributing

If you have a new function in mind to be hosted in phosphor-misc, it is usually a good idea to mention it on the OpenBMC mailing list before writing any code. There might already be an implementation of the desired function or the community may suggest alternatives.

phosphor-misc patches are reviewed using the Gerrit instance at https://gerrit.openbmc-project.xyz.

Please submit patches to Gerrit. More information on using Gerrit can be found here. https://github.com/openbmc/phosphor-misc is a hosting mirror only and GitHub pull requests are not monitored and will not be accepted.

Patch checklist. Please ensure patches adhere to the following guidelines:

For questions or help please come join us on the mailing list or in IRC.