View Single Post
Community Council | Posts: 4,920 | Thanked: 12,867 times | Joined on May 2012 @ Southerrn Finland
#199
Originally Posted by peterleinchen View Post
Hey juiceme,
OK, got a dead battery. And put it to charger. Checked again and now return value is "0", so everything okay!
This time bootreason=usb. When I got the 255 the bootreason was sw_rst. Maybe this caused the 255? IDK.
- I still have sometimes weird restart behavior, i.e. after decoupling battery (nemo did not start) it needed a few attempts. It seems bootreason=pwr_off? Maybe change the bootreason in command_line also?
- Charging does not take place when connected charger to powered off phone. it goes to ubi console and does not charge.
Maybe wait for 60s and when there was no telnet connection established (do not know how to detect) then boot to Harmattan (bootreason=act_dead) and let it charge?
OK, finally had time to tweak init a bit, checking the powerup reason. I added the following check before the check for existing USB connection:

Code:
# if boot reason is USB or RTC, boot up directly to default Harmattan
bootreason=$(cat /proc/original_cmdline | cut -d' ' -f12 |  cut -d'=' -f2)
if [ "$bootreason" != "pwr_key" ]; then
  if [ -r /boot/menu/select_default_os.sh ]; then
    mount /mnt/2
    /boot/menu/select_default_os.sh
    if [ $? -eq 0 ]; then
      /usr/bin/disable_pm
      # restart to the default Harmattan OS
      kexec -e ; echo $? ; sleep 10
    fi
  fi
fi
Also added a short script "/boot/menu/select_default_os.sh" which basically does the same thing as "/boot/menu/select_os_animated.sh" when booting to default Harmattan OS & kernel.

Now, what this is supposed to do; When the boot reason is not "pwr_key", meaning the device has woken up either from pugging in USB or RTC event (alarm clock triggering) then instead of normal menu the device should boot to Harmattan directly.

For RTC events this works as it should; device boots up to the alarm handling state and then powers off, just as it would do without ubiboot installed.

Unfortunately it still does not do that when USB is plugged in, at least with computer connected USB (did not try it yet with just dummy charger), instead it tries to boot into Harmattan but goes to boot loop instead.