I'm trying to start my program when I'm not connected to my PC, so my program automatically starts when I run the Neo connected to a USB battery pack, but not when to my development PC. I thought that I could do that by checking if the 7.2 address is configured. I have added to /var/rc.local the following code: Code: usb_inet=$(ifconfig | grep -c 192.168.7.2) if [ $usb_inet -eq 0]; then ... fi Unfortunately it seems that when connected to a battery pack the USB network looks like it is up to, the grep still returns 1. So if it is not the 7.2 ip address, what else could be checked to see how the board was booted.
Perhaps ping your development PC from the Neo, but that will only work if you are not connected to wifi or Ethernet to your network.
Note that usb0 is always up due to settings in /etc/network/interfaces. The line Code: inet addr:192.168.7.2 Bcast:192.168.7.255 Mask:255.255.255.0 is always in ifconfig.
@Gorgo, thanks. I assumed something like this, or at least, I thought that as long as power was detected on the USB port the interface would be up. And as I'm using a powerbank that would be the case in my project. I now use a semi-automatic solution: I check if a certain file exists, and if it does I autostart my program.
Check this: if you plug your battery, is usb0 running or not? If not, you can use Code: ifconfig usb0| grep -c RUNNING
If the Neo is powered from the barrel jack USB0 is not running, if it powered from the battery it is . Thanks for the suggestion.