Sometimes, trying code on the ethoscope is the only way to properly debug a new issue, especially when the issue relates to hardware interfaces such as sleep deprivers. The easiest way is to modify the code directly on the ethoscope. Here is how to do it.

From within the node, ssh into the ethoscope

#if you are not already in the node, enter it
ssh node@your-node-address
#the password is node

#once in, ssh into the ethoscope of choice - check your IP on the node web interface
ssh [email protected]
#the password is alarm

Once you are in the ethoscope, you need to temporarily stop the ethoscope service.

<aside> 🛠 Doing the following will make the ethoscope disappear from the node of course: no panic.

</aside>

#from inside the ethoscope
sudo systemctl stop ethoscope_device ethoscope_listener
#sudo password for alarm is alarm

Next, we want to be able to change the code on the ethoscope without too much trouble. An easy way to do this is to change all permissions on the ethoscope directory first:

#from inside the ethoscope
sudo chown alarm:alarm /opt/ethoscope-device -R 
#now all the files in that folder can be overwritten by the user alarm

#when you are done, make sure you changing this back to how it was with
sudo chown root:root /opt/ethoscope-device -R

Next, you want to mount the ethoscope folder on your computer. Your computer must be able to access the ethoscope directly to do this which means that you must be connected to the ethoscope_wifi network. The easiest way to do this is to map it directly from the node or a computer in the same network that you use to control the node (like we do in our lab). Open the file browser, hit Ctrl-L to show the location bar, and type:

ssh://[email protected]/opt/ethoscope-device/src

When prompted for a password use alarm

Now you can modify directly the files on the ethoscope from your computer. I recommend using a text editor called Geany. After your edits, you will want to start the ethoscope software and test your changes. For this, SSH into the ethoscope again (you probably do not need to do this: your terminal may still be open) and run the server manually

#from within the ethoscope
cd /opt/ethoscope-device/src/scripts
sudo python device_server.py -D

Untitled

If you use good-old print statements you will see them appear in that window. Or you can using the logging library if you feel pro.