[OpenWrt-Devel] [PATCH 0/7] procd: console hotplugging support

Michael Heimpold mhei at heimpold.de
Wed Jan 2 09:07:59 EST 2019


Hi Karl,

if you want to test it, here are the missing pieces roughly explained:
- I used kmod-usb-gadget-eth and kmod-usb-gadget-serial
  I know that there is another (older?) kernel module which also provides
  a network and console interface at the same time, but this must be
  configured via kernel command line parameter if I understand correctly
  so I've chosen to test this configfs approach
- add a line to inittab like this:
   ttyGS0::askfirst:/usr/libexec/login.sh
- patch /etc/hotplug.json on your device like this:

diff --git a/package/system/procd/files/hotplug.json b/package/system/procd/
files/hotplug.json                                             
index 1c949bbea3..25806637cc 100644                                                                                                        
--- a/package/system/procd/files/hotplug.json                                                                                              
+++ b/package/system/procd/files/hotplug.json                                                                                              
@@ -33,6 +33,10 @@                                                                                                                         
                                        [ "load-firmware", "/lib/firmware" ],                                                              
                                        [ "return" ]                                                                                       
                                ]                                                                                                          
+                 ],                                                                                                                       
+                 [ "if",                                                                                                                  
+                         [ "regex", "DEVNAME", "^tty[A-Za-z0-9]" ],                                                                       
+                         [ "start-console", "%DEVNAME%" ]                                                                                 
                        ]                                                                                                                  
                ],                                                                                                                         
                "remove" : [

- I used a shell script found at 
http://irq5.io/2016/12/22/raspberry-pi-zero-as-multiple-usb-gadgets/
 to configure the gadget

I'll send a patch for hotplug.json after I got some feedback
for this procd stuff or better - in case this is merged, because otherwise we 
have a dependency issue otherwise...
Another point on my list is auto-mounting of configfs to the right place. I'm 
feeling that this should not be part of the shell script but be done at a 
central place - still unsure where to put it because configfs is an optional
kernel module and thus available later during boot...

Best regards,
Michael

Am Mittwoch, 2. Januar 2019, 12:38:30 CET schrieb Karl Palsson:
> Michael Heimpold <mhei at heimpold.de> wrote:
> > This series extends procd to allow starting consoles for
> > devices which are not present during boot or after kernel
> > module loading. This is for example the case when a USB gadget
> > serial device is created with configfs. Here the kernel module
> > is loaded but the tty device only appears after gadget is
> > configured. Having a console configured in inittab for e.g.
> > ttyGS0 does not work at the moment due to late appearing of
> > this device.
> 
> Thanks for doing this, I had been planning on using this (console
> on gadget serial), and didn't even know it didn't work (yet)
> until your mails! Much appreciated!
> 
> Cheers,
> Karl P





_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list