Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
928 Views

How Can We Run a Program Using the OTG Port

Hello Everybody,

I'm looking into doing some custom automation on the Intel Edison. When we run the flashall.bat script, apparently, it uses xfstk-dldr-solo.exe to download and execute stuff. The Arduino environment apparently also downloads and executes sketches over this port. Where can I read some literature about running my own script?

Basically, the automation I want to do (right away) is similar to what the Intel Edison Setup Tool does (e.g. set SSH password, connect to known wifi). How can I quickly get started?

Thanks!

0 Kudos
9 Replies
idata
Community Manager
33 Views

Hi Taimoor,

 

 

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.

 

 

Regards,

 

-Leonardo
idata
Community Manager
33 Views

Hello Leonardo,

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?

Best,

Taimoor

idata
Community Manager
33 Views

BTW, the Intel Edison Board Configuration Tool uses the same port for these configurations as well. (Wifi, SSH password etc.) (https://software.intel.com/en-us/iot/hardware/edison/downloads Downloads for Intel® Edison Module | IoT | Intel® Software )

idata
Community Manager
33 Views

Hey Leonardo,

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!

- Taimoor

idata
Community Manager
33 Views

Hi Taimoor,

 

 

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 ctrl_interface=/var/run/wpa_supplicant ctrl_interface_group=0 config_methods=virtual_push_button virtual_display push_button keypad update_config=1 fast_reauth=1 device_name=Edison manufacturer=Intel model_name=Edison   network={  ssid="YOUR_NETWORK"    key_mgmt=WPA-PSK  pairwise=CCMP TKIP  group=CCMP TKIP WEP104 WEP40  eap=TTLS PEAP TLS  psk="YOUR_PASSWORD" } EOF # 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.

 

 

Regards,

 

-Leonardo
idata
Community Manager
33 Views

Hey Leonardo,

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.

Best Regards

Taimoor

idata
Community Manager
33 Views

Hi Taimoor,

 

 

That's awesome, I will be waiting for your results.

 

 

Don't doubt to ask us if you have issues.

 

 

Regards,

 

-Leonardo
idata
Community Manager
33 Views

Hello Leo,

So, here's the story of how I managed to resolve this...

  1. First off, I modified the configure_edison() script to my liking and renamed it.
  2. I added a recipe (inherited from systemd) to start this script.
  3. 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.

idata
Community Manager
33 Views

Hi Taimoor,

 

 

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.

 

 

Regards,

 

-Leonardo