How I bypass unattended start

Started by flavigny, October 08, 2012, 09:49:08 PM

Previous topic - Next topic

flavigny

Hello,

:( CAUTION: THIS IS AN EXPERIEMTAL WORK, DON'T USE IF if you are not sure it is correct.
I hope that some guru will validate the design.
:) Thanks to them.

My project is running without login (launhed by a symbolic link in /etc/rc5.d).

Of course, sometimes, due to malicious mistakes, it does'nt run and I am not able to retrieve control and perform login.

Previously, I moved the sdcard on my huge linux box, and removed autostart process.

Here is how I plan to allow a "safe boot", disabling script and waiting for login:

1) I build a strap with 1 kilo Ohms resistor between pins 17 (gpio1) and 19 (gpio0). Later I will add a push button switch labelled "Emergency Start".

2) in front of my script I add a few lines:
#!/bin/sh -v
# login if bridge between gpio0 and gpio1 , else run script
echo in > /sys/class/gpio/gpio0/direction
echo out > /sys/class/gpio/gpio1/direction
echo directions set
# check original state
echo gpio0 is: `cat /sys/class/gpio/gpio0/value`
echo gpio1 is: `cat /sys/class/gpio/gpio1/value`
sleep 1
echo 1 > /sys/class/gpio/gpio1/value
sleep 1
if [ `cat /sys/class/gpio/gpio0/value` -eq 1 ]
then
  echo emergency
# do nothing, will ask for login
else
echo emergency
# code to be run without login
....
....
fi


Now, when a login is required, I plug the strap and boot the OlinuxIno

Of course, there is a lot of alternative designs (with only one gpio) but for me, I have a lot of gpio available.

Regards.
PO.