Message ID | 20231111-dns313-usb-serial-v1-1-6402033bcdfb@linaro.org |
---|---|
State | Rejected, archived |
Delegated to: | Linus Walleij |
Headers | show |
Series | Enable USB serial console on the D-Link DNS-313 | expand |
Hi! On Sun, Nov 12, 2023 at 6:04 AM Linus Walleij <linus.walleij@linaro.org> wrote: > > For devices using USB gadget serial we need to probe the modules > usb_f_acm and g_serial in order, then the available UDC (USB device > controller) interface will be hooked up to a serial port as > /dev/ttyGS0. (On the host side this appears as /dev/ttyACM0 > when plugging in the USB cable.) > > I don't quite understand why this wasn't done before for the > module explicitly called kmod-usb-serial. 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? :)
Hi Linus, W dniu 2023-11-11 o 23:02, Linus Walleij pisze: > For devices using USB gadget serial we need to probe the modules > usb_f_acm and g_serial in order, then the available UDC (USB device > controller) interface will be hooked up to a serial port as > /dev/ttyGS0. (On the host side this appears as /dev/ttyACM0 > when plugging in the USB cable.) > > I don't quite understand why this wasn't done before for the > module explicitly called kmod-usb-serial. > > Before this patch we have to enter a console and type > > modprobe g_serial > > To get a serial console on /dev/ttyGS0, after this it is > automatic. > > Since you might only have the serial console, it is a bit > catch 22 to have to use a serial console to activate the > serial console. > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > package/kernel/linux/modules/usb.mk | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk > index 0a5f5a8993c9..f54dc4380737 100644 > --- a/package/kernel/linux/modules/usb.mk > +++ b/package/kernel/linux/modules/usb.mk > @@ -207,7 +207,7 @@ define KernelPackage/usb-gadget-serial > $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_obex.ko \ > $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_serial.ko \ > $(LINUX_DIR)/drivers/usb/gadget/legacy/g_serial.ko > - AUTOLOAD:=$(call AutoLoad,52,usb_f_acm) > + AUTOLOAD:=$(call AutoLoad,52,usb_f_acm g_serial) > $(call AddDepends/usb) > endef > > I think I know the reason why it isn't the case. kmod-usb-gadget-cdc-composite which pulls both kmod-usb-gadget-serial and kmod-usb-gadget-eth packages, and including autoprobingf g_serial within this would clash with that. I think the gadget configuration itself (apart from implementation) could be packaged separately and included as device packages, pulling needed dependencies. And something like that just appeared on Github: https://github.com/openwrt/openwrt/pull/14005/
On Sun, Nov 19, 2023 at 2:27 PM Chuanhong Guo <gch981213@gmail.com> wrote: > On Sun, Nov 12, 2023 at 6:04 AM Linus Walleij <linus.walleij@linaro.org> wrote: > > > > For devices using USB gadget serial we need to probe the modules > > usb_f_acm and g_serial in order, then the available UDC (USB device > > controller) interface will be hooked up to a serial port as > > /dev/ttyGS0. (On the host side this appears as /dev/ttyACM0 > > when plugging in the USB cable.) > > > > I don't quite understand why this wasn't done before for the > > module explicitly called kmod-usb-serial. > > 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? :) This is a step in the right direction as it moves toward using configfs as is custom these days, approved. I think I would need an example of how to utilize this for the serial gadget though... Yours, Linus Walleij
diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 0a5f5a8993c9..f54dc4380737 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -207,7 +207,7 @@ define KernelPackage/usb-gadget-serial $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_obex.ko \ $(LINUX_DIR)/drivers/usb/gadget/function/usb_f_serial.ko \ $(LINUX_DIR)/drivers/usb/gadget/legacy/g_serial.ko - AUTOLOAD:=$(call AutoLoad,52,usb_f_acm) + AUTOLOAD:=$(call AutoLoad,52,usb_f_acm g_serial) $(call AddDepends/usb) endef
For devices using USB gadget serial we need to probe the modules usb_f_acm and g_serial in order, then the available UDC (USB device controller) interface will be hooked up to a serial port as /dev/ttyGS0. (On the host side this appears as /dev/ttyACM0 when plugging in the USB cable.) I don't quite understand why this wasn't done before for the module explicitly called kmod-usb-serial. Before this patch we have to enter a console and type modprobe g_serial To get a serial console on /dev/ttyGS0, after this it is automatic. Since you might only have the serial console, it is a bit catch 22 to have to use a serial console to activate the serial console. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- package/kernel/linux/modules/usb.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)