We are not sure what do you want to do exactly with the OTG Port, so if you can give us more information that would be great.
As far as I'm concerned, if you want to run a script when your Edison initiates, the best way to do it is running the script when the Edison is booting.
We'll be waiting for your information.
Thanks for the reply. I just want to automate setting up of Wifi connection and SSH password right after the image gets flashed in. From there, the automation scripts can take over.
I could add a custom layer (haven't figured out how to do that yet) in Bitbake ... that too might be an option. How do you suggest I go about this? I just want to be able to connect to a known Wifi SSID, and set a known root password. What's a good practice in this scenario?
So I managed to modify the wpa_supplicant recipe and have a default wifi configuration set up in the Edison. But, I still need to log into the edison to start the wpa_supplicant service (systemctl start wpa_supplicant). Do you know how I can start it automagically after first boot?
Simply enabling this service is enough for the edison to connect with the intended wifi network. I'm doing some code-digging but can you guide me in the correct direction?
Thank you very much!
Thank you so much for explaining us your question, let me say that this is an interesting question and I’d love to help you with that. I personally think that the best way to do this automation is modifying the image adding the custom layer.
I think that this process can be done with 3 main steps, the steps are:
1. Create a script to connect to a specific network.
2. Create a script to set a known root password.
3. Add a recipe that includes these 2 scripts and create the image.
For these steps the only information that I have available right now is for the step 1 and looks like you already did this, but just in case to connect to specific network manually you have to run the following commands:
ifconfig wlan0 down
#THE FOLLOWING IS JUST ONE COMMAND
cat << EOF > /etc/wpa_supplicant/wpa_supplicant.conf
config_methods=virtual_push_button virtual_display push_button keypad
group=CCMP TKIP WEP104 WEP40
eap=TTLS PEAP TLS
#THE COMMAND ENDS IN THE LINE ABOVE
systemctl restart wpa_supplicant.service
ifconfig wlan0 up
You can try to create a script with these commands and change the ssid with the network name, and the psk with the password.
I know this is only the step 1 but I think this is a great way to start this process. I hope this information helps you a lot.
Thanks for your answer. It totally makes a lot of sense and I'll try it this week (hopefully) as soon as I find some time. I'll let you know here.
So, here's the story of how I managed to resolve this...
- First off, I modified the configure_edison() script to my liking and renamed it.
- I added a recipe (inherited from systemd) to start this script.
- The script disables the unit file (calling systemctl disable my.service)
This has a few advantages over my earlier adventures in that the script is easy to modify and the bitbake builds are pretty fast.
Once connected to your network, and having a known password, you can just run tools for config management. I will write more about this on a blog post this weekend hopefully. Will post the link down here too...
Thanks again Leo!! Great help.
That’s awesome, it is good to hear that.
And yes please post the link, it can be very useful for the community.
Have a nice day.