abc613ef | 01-Sep-2024 |
Igor Kononenko <i.kononenko.e@gmail.com> |
usb-ctrl: fix optional mac-addresses
The `help` usb-ctrl declares the MAC options for ecm|emm|rndis optional. But if they are skipped, the operation will fail.
The change fixes the problem and the
usb-ctrl: fix optional mac-addresses
The `help` usb-ctrl declares the MAC options for ecm|emm|rndis optional. But if they are skipped, the operation will fail.
The change fixes the problem and the MAC settings can now be safely omitted.
Tested: each of the commands below works fine:
* `usb-ctrl ecm usb0 on` * `usb-ctrl ecm usb0 on .` * `usb-ctrl ecm usb0 on . 5e:e9:8e:01:fa:b4` * `usb-ctrl ecm usb0 on 5e:e9:8e:01:fa:b3 5e:e9:8e:01:fa:b3`
Change-Id: I7096476656d2f830c32fbc6cb9c784b3ba6bbd2f Signed-off-by: Igor Kononenko <i.kononenko.e@gmail.com>
show more ...
|
a0f38eeb | 14-Dec-2023 |
Igor Kononenko <i.kononenko.e@gmail.com> |
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.
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>
show more ...
|
0100b593 | 29-Nov-2023 |
Patrick Williams <patrick@stwcx.xyz> |
build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer retur
build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer return true for auto features. Instead, the expectation is to use `allowed()` which is true for both enabled and auto.
Switch all uses of `enabled` to `allowed`.
Change-Id: Ieb1a6b353443eabfdc157a80b0e998e35202820f Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
37c76da7 | 08-Dec-2022 |
Patrick Williams <patrick@stwcx.xyz> |
beautysh: re-format
beautysh is enabled in the openbmc-build-scripts on Bash/Zsh/POSIX-sh files to have a consistent formatting. Re-run the formatter on the whole repository.
Change-Id: Ib1e9ab2fa
beautysh: re-format
beautysh is enabled in the openbmc-build-scripts on Bash/Zsh/POSIX-sh files to have a consistent formatting. Re-run the formatter on the whole repository.
Change-Id: Ib1e9ab2fa4867e4f89401c97e3e4694fa3ea6765 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
272b453c | 04-Dec-2022 |
Patrick Williams <patrick@stwcx.xyz> |
shellcheck: fix issues and format with beautysh
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ib06266cbe243a3e70a4c468c0d4d2c4d2b1f1914 |
8ae2fcd1 | 26-Apr-2022 |
Jae Hyun Yoo <quic_jaehyoo@quicinc.com> |
usb-ctrl: add RNDIS and EEM type support
Add RNDIS and EEM gadget type support. These kernel configs should be enabled for RNDIS and EEM respectively.
CONFIG_USB_F_RNDIS CONFIG_USB_CONFIGFS_RNDIS
usb-ctrl: add RNDIS and EEM type support
Add RNDIS and EEM gadget type support. These kernel configs should be enabled for RNDIS and EEM respectively.
CONFIG_USB_F_RNDIS CONFIG_USB_CONFIGFS_RNDIS
CONFIG_USB_F_EEM CONFIG_USB_CONFIGFS_EEM
Tested: RNDIS and EEM type USB ethernet gadgets were created properly.
Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com> Change-Id: I562fbf0e9f19e38190174cc2b5cc64bfde182c8b
show more ...
|
688e9134 | 27-Apr-2021 |
Milton Miller <miltonm@us.ibm.com> |
usb_ctrl: clean up usb storage configuration
The usb storage interface selection had significant factoring during the review process. Here are a few cleanups I found reviewing ecm MAC addresses.
-
usb_ctrl: clean up usb storage configuration
The usb storage interface selection had significant factoring during the review process. Here are a few cleanups I found reviewing ecm MAC addresses.
- We already handled the default empty + Anything else is Unknown not Illegal - Usually its called a backing file, but use backing storage here + We also support backing devices + The variable name is storage - Specify the default storage interface in one place + By shortening the variable name we can avoid a wrapped line + Instead add a comment on default handling in the setter
Signed-off-by: Milton Miller <miltonm@us.ibm.com> Change-Id: I09fad56f3ae4a92c1394e69acd5a82775b409aef
show more ...
|
cf69740e | 01-Mar-2021 |
Lei YU <yulei.sh@bytedance.com> |
usb-ctrl: Add support to set BMC and Host's mac address
By default it uses the random MAC address when usb ecm is enabled. Inspired from usb-network.sh in meta-quanta, it is possible to specify the
usb-ctrl: Add support to set BMC and Host's mac address
By default it uses the random MAC address when usb ecm is enabled. Inspired from usb-network.sh in meta-quanta, it is possible to specify the MAC address.
Add optional arguments to set the MAC address when ecm is enabled, so that the BMC and Host side's MAC addresses are known.
Tested: Verify the MAC addresses could be specified by below command:
usb-ctrl ecm usbeth0 on <bmc-addr host-addr>
Signed-off-by: Lei YU <yulei.sh@bytedance.com> Signed-off-by: Milton Miller <miltonm@us.ibm.com> Change-Id: I4a944d62d3bbb7e57d1beab90e435663d3ff1e1f
show more ...
|
75d4734f | 30-Sep-2020 |
Milton Miller <miltonm@us.ibm.com> |
usb-ctrl: factor and simplify quoting, reorder interface_type
The function name in sysfs was assembled several times when configuring a mass storage device. Change usb_set_interface_type to not exp
usb-ctrl: factor and simplify quoting, reorder interface_type
The function name in sysfs was assembled several times when configuring a mass storage device. Change usb_set_interface_type to not expect the path to have a trailing slash. Consolidate the function name to one variable and use it.
Quote complete strings instead of individual variables reducing the number of quotes needed. Quotes are not required when a safe string is assigned within the script.
Also set filename after calling usb_set_iterface_type which may help some cases (read-only files on read-only device type?).
Change-Id: I6c070957b1b9b36693af5717566d9bb13e93269d Signed-off-by: Milton Miller <miltonm@us.ibm.com>
show more ...
|
01c3ff22 | 28-Sep-2020 |
Milton Miller <miltonm@us.ibm.com> |
usb-ctrl: Double Quote usb_gadget_syspath
Place uses of usb_gadget_syspath in double quotes to prevent shell iterpolation of the variable.
The usb_gadget_syspath variable is derived from the name v
usb-ctrl: Double Quote usb_gadget_syspath
Place uses of usb_gadget_syspath in double quotes to prevent shell iterpolation of the variable.
The usb_gadget_syspath variable is derived from the name variable which is a script command line argument.
Change-Id: I48f64e65ef1f98990e8642bbe7c7969c58a5b632 Signed-off-by: Milton Miller <miltonm@us.ibm.com>
show more ...
|
2af04734 | 15-Sep-2020 |
Igor Kononenko <i.kononenko@yadro.com> |
usb-ctrl: adds to configure the usb interface type
Implementation of adjust interface type of inserting usb-gadget:
```usb-ctrl insert <name> <file> [<type=usb|usb-ro|hdd|cdrom>]```
* usb - RW
usb-ctrl: adds to configure the usb interface type
Implementation of adjust interface type of inserting usb-gadget:
```usb-ctrl insert <name> <file> [<type=usb|usb-ro|hdd|cdrom>]```
* usb - RW, Removable USB-flash * usb-ro - RO, USB-flash * hdd - RW, USB-HDD * cdrom - RO, Removable USB-CDROM
If type not specified or illegal then using 'usb-ro' as default
Tested: calling `usb-ctrl insert` with each posible value (usb|usb-ro|hdd|cdrom); additionally been call with empty value and with invalid value 'err_type':
* ``` root@:~# usb-ctrl insert usb0 /dev/nbd0 usb
root@:~# cat /sys/.../mass-storage/....usb0/lun.0/cdrom 0 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/ro 0 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/removable 1
root@:~# usb-ctrl insert usb0 /dev/nbd0 usb-ro
root@:~# cat /sys/.../mass-storage/....usb0/lun.0/cdrom 0 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/ro 1 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/removable 1
root@:~# usb-ctrl insert usb0 /dev/nbd0 hdd
root@:~# cat /sys/.../mass-storage/....usb0/lun.0/cdrom 0 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/ro 0 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/removable 0
root@:~# usb-ctrl insert usb0 /dev/nbd0 cdrom
root@:~# cat /sys/.../mass-storage/....usb0/lun.0/cdrom 1 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/ro 1 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/removable 1
root@:~# usb-ctrl insert usb0 /dev/nbd0 No mass-storage interface type specified or illegal Configuring interface type to 'usb-ro'
root@:~# cat /sys/.../mass-storage/....usb0/lun.0/cdrom 0 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/ro 1 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/removable 1
root@:~# usb-ctrl insert usb0 /dev/nbd0 err_type No mass-storage interface type specified or illegal Configuring interface type to 'usb-ro'
root@:~# cat /sys/.../mass-storage/....usb0/lun.0/cdrom 0 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/ro 1 root@:~# cat /sys/.../mass-storage/....usb0/lun.0/removable 1 ```
Signed-off-by: Igor Kononenko <i.kononenko@yadro.com> Change-Id: I46155e28ec7a441863ce86f425a46ac1297444ed
show more ...
|
4285bbf8 | 27-May-2020 |
Lei YU <yulei.sh@bytedance.com> |
usb-ctrl: Support ecm device
Enhance this script to support insert/eject ecm device, so that BMC could "attach" a virtual USB ethernet between the BMC and the host.
Note that the function depends o
usb-ctrl: Support ecm device
Enhance this script to support insert/eject ecm device, so that BMC could "attach" a virtual USB ethernet between the BMC and the host.
Note that the function depends on the ECM related kernel configs. To insert/eject ecm device:
usb-ctrl ecm usb0 on usb-ctrl ecm usb0 off
Tested: Build kernel with below extra configs, and verify that the above commands creates/remove the USB ethernet bewteen BMC and host.
+CONFIG_USB_U_ETHER=y +CONFIG_USB_F_ECM=y +CONFIG_USB_CONFIGFS_ECM=y
Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: I22796076609abaeab5c1e9e7996bcac28e7f6348
show more ...
|
ec5cf180 | 03-Jun-2020 |
Lei YU <yulei.sh@bytedance.com> |
usb-ctrl: quote variables
Fix some review comments from the above commit.
Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: I840164b05e83bcd4d01f7f8fca25f316275185aa |
52aed33d | 27-May-2020 |
Lei YU <yulei.sh@bytedance.com> |
Add usb-ctrl for USB gadget control
The usb-ctrl is copied from [intel-bmc][1] that creates/destroy USB mass-storage devices via USB gadget driver. It supports multiple devices and could be extended
Add usb-ctrl for USB gadget control
The usb-ctrl is copied from [intel-bmc][1] that creates/destroy USB mass-storage devices via USB gadget driver. It supports multiple devices and could be extended with future features.
[1]: https://github.com/Intel-BMC/openbmc/blob/intel/meta-openbmc-mods/meta-common/recipes-core/fw-update/files/usb-ctrl
Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: Ie875e7e385ddacef82b7e4d20795c97c001384b3
show more ...
|