Re: [OpenWrt-Devel] [PATCH 0/7] procd: console hotplugging support
Hi, I'll save that for when I get back to it :) Here's how I packaged the g_cdc (ethernet+cdc-acm together) https://github.com/karlp/openwrt/commit/40c791f5bfbbf6825087db2fc87f88a73f7fa94c I've got a few other patches for gadgetmode, but some of it needs a bitmore testing yet, so I've not proposed it to openwrt yet. Cheers, Karl P Michael Heimpold wrote: > 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 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 > > > > signature.html Description: OpenPGP Digital Signature ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 0/7] procd: console hotplugging support
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 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@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 0/7] procd: console hotplugging support
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. The changes in this series are the first step to make this work, the next one would be to extend the hotplug.json script to re-trigger inittab entry processing. The series also includes some nitpicks I stumbled over during coding. It can also be found in a Github repo: https://github.com/mhei/openwrt-procd/tree/console-hotplugging Michael Heimpold (7): procd: simplify code in procd_inittab_run procd: guard fork_worker calls procd: skip respawn in case device disappeared procd: shift arguments for askfirst only once procd: add start-console support procd: add upgraded binary to .gitignore procd: replace exit(-1) with exit(EXIT_FAILURE) .gitignore | 1 + initd/init.c| 2 +- initd/preinit.c | 6 +++--- initd/zram.c| 4 ++-- inittab.c | 48 + plug/coldplug.c | 3 ++- plug/hotplug.c | 31 +++-- upgraded/upgraded.c | 2 +- 8 files changed, 66 insertions(+), 31 deletions(-) -- 2.17.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel