Keyboard fails during 'init' script - a different approach

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#46 Post by peebee »

gyro wrote:
peebee wrote:Result is below - not sure whether this is what is expected? I think I was expecting "silence".....
Thanks for testing.

You're actually running "initmodules" version 1.1.
The message at the top of the 2 pane page should be the same as seen in gcmartin's example.
Try executing "/root/my-applications/bin/initmodules" directly.

If you want "initmodules" verrsion 2.3 to be quiet, you need to append a "-q" parameter to the command line.

Note: Woof-CE contains "initmodules" version 1.1, and I think it puts it in "/usr/bin".

gyro
Hi gyro

Sorry to confuse - will test again - properly....
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#47 Post by gyro »

peebee wrote:Sorry to confuse - will test again - properly....
That would be great.
One more thing, could you please run:

Code: Select all

which initmodules
to confirm where the old "initmodules" is.
gyro

User avatar
peebee
Posts: 4370
Joined: Sun 21 Sep 2008, 12:31
Location: Worcestershire, UK
Contact:

#48 Post by peebee »

gyro wrote:
peebee wrote:Sorry to confuse - will test again - properly....
That would be great.
One more thing, could you please run:

Code: Select all

which initmodules
to confirm where the old "initmodules" is.
gyro
1. test on k4.4.1-stemsee fairly recent woof-ce build with no problem with keyboard during boot

2. test on k3.14.20 tahrpup 6.0 with problem
Attachments
Screenshot.png
(178.35 KiB) Downloaded 260 times
capture20683.png
(141.84 KiB) Downloaded 266 times
ImageLxPup = Puppy + LXDE
Main version used daily: LxPupSc; Assembler of UPups, ScPup & ScPup64, LxPup, LxPupSc & LxPupSc64

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#49 Post by mavrothal »

Works fine.
A little patch that makes wording conditional on the findings. Can be improved I'm sure.

Code: Select all

--- initmodules.orig	2016-02-17 08:55:14.000000000 +0200
+++ initmodules	2016-02-22 14:05:52.000000000 +0200
@@ -209,7 +209,14 @@
 
 kill $MSGPID
 
-RESMODLIST="$(Xdialog --wmclass "module16" --title "$MSGT" --left --stdout --separator " " --buildlist "$(gettext 'The left pane shows the modules that are currently loaded.\nThe right pane shows the modules that Initmodules has determined\nshould be loaded by "init" so the keyboard works during startup.\n\nMove modules betweeen panes using the "Add" and "Remove" buttons.\nWhen the list in the right pane is complete, click the "OK" button.\nOn reboot, these modules will be loaded by the "init" script,\nso devices required by the "init" script will now work. For example,\nthe keyboard might now work to select a savefile/savefolder.\n\nClicking on "OK" while the right pane is empty,\n will remove any existing Initmodules configuration file.\n\nIf you do not know which module(s) need to be loaded by "init",\naccept the defaults as determined by Initmodules, simply click "OK".')" 0 0 8 $DLGMODLIST)"
+if [ "$MODLIST" = "" ];then
+	MSG_MOD="$(gettext '\nThe right pane is empty because Initmodules did not find any \nkeyboard needed modules that should be loaded by "init".')"
+else
+	MSG_MOD="$(gettext '\nThe right pane shows the modules that Initmodules has determined\nshould be loaded by "init" so the keyboard works during startup.')"
+fi
+
+
+RESMODLIST="$(Xdialog --wmclass "module16" --title "$MSGT" --left --stdout --separator " " --buildlist "$(gettext 'The left pane shows the modules that are currently loaded.') $MSG_MOD $(gettext '\n\nIf this is incorrect move modules betweeen panes using the "Add" \nand "Remove" buttons. When the you finish click the "OK" button.\n\nOn reboot, the modules on the right pane will be loaded during\n"init" so the keyboard may now work to select a savefile/folder.\nNotice that clicking on "OK" while the right pane is empty, will\nremove any previous Initmodules configuration file.\n\nIf you do not know which module(s) need to be loaded by "init",\naccept the defaults as determined by Initmodules, simply click "OK".')" 0 0 8 $DLGMODLIST)"
 [ $? -ne 0 ] && exit 1
 
 write_modlist "$RESMODLIST"
(notice that the forum may add spaces at the end of the lines)
Last edited by mavrothal on Mon 22 Feb 2016, 13:04, edited 1 time in total.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#50 Post by gyro »

@peebee,
Great.
Looks like my pet should put it in "/usr/sbin" so that it will overwrite any older one.

@mavrothal,
I like the idea, will do.
I'll review the actual wording and get back.

Edit: The diff looks a bit messy in the forum, but when I cut and paste it into a file, it looks ok.

gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#51 Post by mavrothal »

gyro wrote: Edit: The diff looks a bit messy in the forum, but when I cut and paste it into a file, it looks ok.
Note that the original condition was wrong.
Should be

Code: Select all

if [ "$MODLIST" = "" ];then 
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#52 Post by gyro »

@mavrothal,

Here's my version of the patch:

Code: Select all

--- initmodules.orig	2016-02-17 16:55:14.481982000 +1000
+++ initmodules	2016-02-22 23:40:38.960907970 +1000
@@ -209,7 +209,13 @@
 
 kill $MSGPID
 
-RESMODLIST="$(Xdialog --wmclass "module16" --title "$MSGT" --left --stdout --separator " " --buildlist "$(gettext 'The left pane shows the modules that are currently loaded.\nThe right pane shows the modules that Initmodules has determined\nshould be loaded by "init" so the keyboard works during startup.\n\nMove modules betweeen panes using the "Add" and "Remove" buttons.\nWhen the list in the right pane is complete, click the "OK" button.\nOn reboot, these modules will be loaded by the "init" script,\nso devices required by the "init" script will now work. For example,\nthe keyboard might now work to select a savefile/savefolder.\n\nClicking on "OK" while the right pane is empty,\n will remove any existing Initmodules configuration file.\n\nIf you do not know which module(s) need to be loaded by "init",\naccept the defaults as determined by Initmodules, simply click "OK".')" 0 0 8 $DLGMODLIST)"
+if [ "$MODLIST" ]; then
+   MSG_MOD="$(gettext '\nThe right pane shows the modules that Initmodules has determined\nshould be loaded by "init" so the keyboard works during startup.')"
+else
+   MSG_MOD="$(gettext '\nThe right pane is empty because Initmodules did not find any \nkeyboard needed modules that should be loaded by "init".')"
+fi
+
+RESMODLIST="$(Xdialog --wmclass "module16" --title "$MSGT" --left --stdout --separator " " --buildlist "$(gettext 'The left pane shows the modules that are currently loaded.') $MSG_MOD $(gettext '\n\nThis can still be modified by moving modules betweeen panes\nusing the "Add" and "Remove" buttons.\nWhen finished, click the "OK" button, to write a configuration file.\n\nOn reboot, modules shown in the right pane will be loaded during\n"init" so the keyboard may now work to select a savefile/folder.\nNotice that clicking on "OK" while the right pane is empty, will\nremove any previous Initmodules configuration file.\n\nIf you do not know which module(s) need to be loaded by "init",\naccept the defaults as determined by Initmodules, simply click "OK".')" 0 0 8 $DLGMODLIST)"
 [ $? -ne 0 ] && exit 1
 
 write_modlist "$RESMODLIST"
gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#53 Post by mavrothal »

Looks good.
Pull?
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#54 Post by gyro »

mavrothal wrote:Looks good.
Pull?
Yes, I'm getting there.
There will also be a new ".pet" for puppies built with older versions of woof-CE.
gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#55 Post by gyro »

Thanks everyone for sticking with this little project.

I have released what should be the final final version 2.3.1.
See the first post for the download of the ".pet".

Only 2 changes:
1) Message on 2 pane screen changed as per mavrothal's suggestion.
2) Moved the location of the script in the ".pet" to "/usr/sbin" to avoid the testing problem I inflicted on peebee.

There's just one more thing, making use of the "quiet" mode.
I intend to produce a patch for "rc.shutdown" that will copy any config file found in "/tmp" into the directory containing the newly created save layer on first shutdown. This should do nothing until "initmodules" is executed during pupmode=5, either in "quiet" mode or "interactive" mode.

I still don't understand why "Boot Manager" refuses to run in pupmode=5.
Any file it writes will be preserved if a save layer is created at first shutdown, but discarded if not. Surely this is the same as for any other setting-up you do.

gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#56 Post by mavrothal »

gyro wrote: I still don't understand why "Boot Manager" refuses to run in pupmode=5.
Any file it writes will be preserved if a save layer is created at first shutdown, but discarded if not. Surely this is the same as for any other setting-up you do.
I think this is more for a coding convinience because at pupmode 5 bootmanager has a hard time locating the extra SFSs that suppose to handle. By now sfs_load does that but the code is still there. Patches are welcome :D
But in the initmodules case and pupmode 5, it can be called by the quicksetup in the quieted mode and bypass the need for the boot manager.
If you do want a GUI in pupmode 5 you can give it a desktop file and a script that will add to it "Nodisplay=true" if not in pupmode=5.
But I think all these are an overkill. The chance for someone to need the keyboard at first reboot during init and at the same time initmodules to have failed to pick the correct module in quite mode, is mostly theoretical.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#57 Post by gyro »

mavrothal wrote:I think this is more for a coding convinience because at pupmode 5 bootmanager has a hard time locating the extra SFSs that suppose to handle. By now sfs_load does that but the code is still there. Patches are welcome :D
I'll put it on my todo list to investigate allowing "Boot Manager" to run in pupmode=5, including the possible removal of it's ability to do extra sfs stuff, that can be left to sfs-load.

gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#58 Post by mavrothal »

gyro wrote:including the possible removal of it's ability to do extra sfs stuff, that can be left to sfs-load.
You do not want to do that. In some puppy in the resent past (can not remember now) boot manager was the only way to automatically load sfs at boot (because of some sfs_load bug).
Is always good to have an alternative.
Better inactivate sfs managing in pupmode 5 instead.

Latter: Here is a patch and a pet for bootmanager. I'll probably commit after some testing assuming that some will done by someone else too.

Code: Select all

--- a/usr/sbin/bootmanager
+++ b/usr/sbin/bootmanager
@@ -84,11 +84,6 @@
 [ "$BYPASSSERIALPROBING" = "yes" ] && DEFAULT_SERIAL="true"
 [ "$FASTBOOTMODULESLIST" != "" ] && DEFAULT_FAST="true"
 
-if [ "$PUPMODE" = "5" ];then
- /usr/lib/gtkdialog/box_ok "$(gettext 'Boot manager')" error "$(gettext 'You must shutdown and create a personal save file first.')"
- exit
-fi
-
 xEXTRASFSMNTPTx="" #100711
 if [ "$PUP_HOME" = "" ];then #defined in PUPSTATE.
  EXTRASFSMNTPT='/'
@@ -445,8 +440,18 @@
 fi
 
 if [ "$CLPARAM1" = "extrasfs" ];then
- extrasfs_func
- exit
+ if [ "$PUPMODE" = "5" ]; then 
+  if [ ! "$(which sfs_load)" ];then
+   /usr/lib/gtkdialog/box_ok "$(gettext 'Boot manager')" error "$(gettext 'You must shutdown and create a personal save file first to use this feature.')"
+   exit
+  else
+   sfs_load
+   exit
+  fi
+ else
+  extrasfs_func
+  exit
+ fi
 
 elif [ "$CLPARAM1" = "blacklist" ];then
  blacklist_func
Attachments
bootmanager_mode5-1.pet
bootmanager that works in PUPMODE=5
(8.93 KiB) Downloaded 201 times
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#59 Post by gyro »

mavrothal wrote:Here is a patch and a pet for bootmanager. I'll probably commit after some testing assuming that some will done by someone else too.
Is the "bootmanager" in the pet supposed to include the "initmodules" patch from earlier?

I setup a zdrv for slacko64, including current "initmodules", patched "rc.shutdown" and the "bootmanager" from your pet.
On first boot it did not load any module.
"bootmanager" did run but didn't seem to have any "initmodules" support.
I ran "initmodules" interactively, creating a config file in "/tmp".
On reboot, module was loaded, config file in same directory as my new savefolder.

gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#60 Post by mavrothal »

gyro wrote:
mavrothal wrote:Here is a patch and a pet for bootmanager. I'll probably commit after some testing assuming that some will done by someone else too.
Is the "bootmanager" in the pet supposed to include the "initmodules" patch from earlier?

I setup a zdrv for slacko64, including current "initmodules", patched "rc.shutdown" and the "bootmanager" from your pet.
On first boot it did not load any module.
"bootmanager" did run but didn't seem to have any "initmodules" support.
I ran "initmodules" interactively, creating a config file in "/tmp".
On reboot, module was loaded, config file in same directory as my new savefolder.

gyro
If by initmodules support you mean call initmodules quietly, it does not (I do not think it should). If you meant that it has relevant button, it does (look also at lines 415 to 441 just above the patch pupmode 5 patch).

Regarding auto run I actually tried it adding a "initmotules -q" call in delayedrun (patch below) when in pupmode 5 and worked like a charm. I think is better in quicksetup within $SET_KEYBOARD, but it was just for testing.
I used an adrv.

Code: Select all

--- a/usr/sbin/delayedrun
+++ b/usr/sbin/delayedrun
@@ -143,6 +143,7 @@
 				$HOME/.xchat2/xchat.conf
 	done
  fi
+ [ "$(which initmodules)" ] && initmodules -q &
 fi
 
 #v2.16 popup a warning if booting from usb flash...
Latter: Actually this patch that will run on first boot and every time the keyboard setting is run may be better.

Code: Select all

--- a/usr/sbin/quicksetup
+++ b/usr/sbin/quicksetup
@@ -8b49,7 +849,8 @@
  ###keyboard layout###
  KEYBOARDXML=""
  if [ "$SET_KEYBOARD" ];then
-
+  # Check if the keyboard needs any kernel modules
+  [ "$(which initmodules)" -a ! -f /mnt/home${PSUBDIR}/${DISTRO_FILE_PREFIX}initmodules.txt ] && initmodules -q & # [ ... -a "$PUPMODE" = "5" ] could do instead
   #120627
   KMAPPATH='/lib/keymaps'
   [ -d /usr/share/kbd/keymaps/i386 ] && KMAPPATH='/usr/share/kbd/keymaps/i386'
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#61 Post by gyro »

mavrothal wrote:If you meant that it has relevant button, it does (look also at lines 415 to 441 just above the patch pupmode 5 patch).
Yes, I was looking for an extra tab, not an extra button on the "Modules" tab.
Running my test again I found that "BootManager" runs. The "initmodules" button is there, and clicking on it produces a config file.

I added a patched "quicksetup" (your patch) to my ydrv and tested again.
Clean pupmode=5 boot, no module loaded.
Did usual changes in "quicksetup".
Did first shutdown, creating save folder.
On boot, module is loaded by "init".

So "initmodules" works.
Patched "BootManager" works.
Patched "quicksetup" works.
Patched "rc.shutdown" works.

Here is my patch to "rc.shutdown":

Code: Select all

--- rc.shutdown.orig	2015-11-16 15:54:33.000000000 +1000
+++ rc.shutdown	2016-02-24 19:50:18.256184272 +1000
@@ -486,6 +486,8 @@
    cp -a $ONEDIR/* /tmp/save1stpup/${BASENAME}/ #v2.16exp3
    [ "$BASENAME" = "root" ] && cp -a $ONEDIR/.[0-9a-zA-Z]* /tmp/save1stpup/${BASENAME}/ #v2.16exp4
   done
+  #copy initmodules config file from /tmp if it exists
+  [ -f /tmp/${DISTRO_FILE_PREFIX}initmodules.txt ] && cp -f /tmp/${DISTRO_FILE_PREFIX}initmodules.txt ${SMNTPT}${SAVEPATH}/${DISTRO_FILE_PREFIX}initmodules.txt
   sync
   [ -L /tmp/save1stpup ] || umount /tmp/save1stpup
 
gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#62 Post by mavrothal »

gyro wrote:So "initmodules" works.
Patched "BootManager" works.
Patched "quicksetup" works.
Patched "rc.shutdown" works.
Put the rest together in a pull then :D
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#63 Post by gyro »

mavrothal wrote:Put the rest together in a pull then :D
I will do "rc.shutdown" and "quicksetup", (even though the later is your patch).
But the "bootmanager" patch I'm not so sure about.
You added the basic "initmodules" support a little while ago. This one's mainly about enabling "bootmanager" to run in pupmode=5, and I certainly have not tested all it's other functions to see how they will cope, have you?

gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#64 Post by mavrothal »

gyro wrote: But the "bootmanager" patch I'm not so sure about.
You added the basic "initmodules" support a little while ago. This one's mainly about enabling "bootmanager" to run in pupmode=5, and I certainly have not tested all it's other functions to see how they will cope, have you?
Yes, and looks fine. However, I do not have any strange modules to blacklist or change priority. I can see that the files are written but can not check their actual functioning.
Any way is committed now. Will see if the next woof build will generate any complains.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

Post Reply