[PATCH 1/2] kernel: usb: Autoprobe g_serial
Chuanhong Guo
gch981213 at gmail.com
Mon Mar 31 18:06:21 PDT 2025
Hi!
On Mon, Mar 31, 2025 at 4:52 PM Linus Walleij <linus.walleij at linaro.org> wrote:
>
> Hi Chuanhong,
>
> sorry for extreme slowness on my part, replying to an over one year old
> question...
>
> On Sun, Nov 19, 2023 at 2:27 PM Chuanhong Guo <gch981213 at gmail.com> wrote:
>
> > The g_*.ko gadget modules conflict with each other. I think
> > it isn't loaded by default to prevent that when users decided
> > to install multiple of them.
> >
> > I made an init script to setup USB gadget using the "modern"
> > configfs approach:
> > https://github.com/openwrt/openwrt/pull/14005
> > Maybe you can make use of this one instead? :)
>
> So this method was merged to OpenWrt which is nice :)
>
> I finally try to use this approach to conclude this.
>
> I made a patch like this:
>
> commit e4bba0549a1b474d3c0346cd1a6cb44f155c9daa (HEAD -> b4/dns313-usb-serial)
> Author: Linus Walleij <linus.walleij at linaro.org>
> Date: Mon Jun 12 00:15:18 2023 +0200
>
> gemini: Activate serial USB console on the DNS-313
>
> This brings up a serial console on the USB device port of
> the DNS-313.
>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
>
> diff --git a/target/linux/gemini/Makefile b/target/linux/gemini/Makefile
> index b2869ff72edf..ddfe67be2bb3 100644
> --- a/target/linux/gemini/Makefile
> +++ b/target/linux/gemini/Makefile
> @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
> ARCH:=arm
> BOARD:=gemini
> BOARDNAME:=Cortina Systems CS351x
> -FEATURES:=squashfs pci rtc usb dt gpio display ext4 rootfs-part boot-part
> +FEATURES:=squashfs pci rtc usb usbgadget dt gpio display ext4
> rootfs-part boot-part
> CPU_TYPE:=fa526
> SUBTARGETS:=generic
>
> diff --git a/target/linux/gemini/base-files/etc/inittab
> b/target/linux/gemini/base-files/etc/inittab
> new file mode 100644
> index 000000000000..253036402d83
> --- /dev/null
> +++ b/target/linux/gemini/base-files/etc/inittab
> @@ -0,0 +1,4 @@
> +::sysinit:/etc/init.d/rcS S boot
> +::shutdown:/etc/init.d/rcS K shutdown
> +::askconsole:/usr/libexec/login.sh
> +ttyGS0::askfirst:/usr/libexec/login.sh
> diff --git a/target/linux/gemini/image/Makefile
> b/target/linux/gemini/image/Makefile
> index 389c8f8c442a..35250538c347 100644
> --- a/target/linux/gemini/image/Makefile
> +++ b/target/linux/gemini/image/Makefile
> @@ -170,7 +170,7 @@ define Device/dlink_dns-313
> DEVICE_VENDOR := D-Link
> DEVICE_MODEL := DNS-313 1-Bay Network Storage Enclosure
> DEVICE_DTS := gemini-dlink-dns-313
> - DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
> + DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
> kmod-usb-gadget-serial usbgadget
> BLOCKSIZE := 1k
> FILESYSTEMS := ext4
> IMAGES := factory.bin.gz
>
>
> The files appear on the target, but clearly the preset dir /usr/share/usbgadget
> is empty.
>
> I realize the idea is that the target should put a config file in there.
>
> Do you have an example of this, because currently there is no target in
> OpenWrt that uses this feature...
>
> I'm trying to figure it out.
>
> Yours,
> Linus Walleij
Presets are packaged separately as usbgadget-{name}. For a serial
port gadget you need to select usbgadget-acm and setup the following
in /etc/config/usbgadget (with uci-defaults ideally):
config preset
option name 'acm'
option UDC 'usb gadget device name'
--
Regards,
Chuanhong Guo
More information about the openwrt-devel
mailing list