SSH battery connected device

I was wondering how I may SSH the device im working on when its power supply is battery instead of cable. When connected to cable the default IP address is 192.168.2.2 as shown in the “Get started”, but when its main power supply is battery, will it still have this IP address or generate a new one? How do i get this new one if so?

The reason I want to use SSH is to be able to read the log from the device when testing outside. Is there maybe a easier way to be able to read the log?

If I test the device outside, then after the test I change the power supply back to the usb cable to my computer and SSH it from there and write ‘logread’ will it contain the log entries from the test or will that be cleaned when it boots up after the power supply change?

Hi @larskarlsen

When using USB connection, the device is the DHCP server, so it will use the 192.168.2.2 IP address whatever is the power supply (USB or Battery).
To my knowledge, logread starts from device boot (I mean there is no persistence of the logs on power-off/reset)

Thanks for the reply @daav. When testing the device outside, there will not be any USB connection, so I was wondering how i can verify my test results then?

I think you could just bring your device inside an plug in the USB cable (without removing the battery) and then ssh into the device and run logread.

ah sweet! I didn’t think about that. Thanks!

Hi @larskarlsen

Other ideas (if you need to power down); at the end of your test, before power down:

  • either run a logread > $HOME/log to persist the log in a file
  • or use the LE_FATAL macro: this should stop the process and persist the log in /mnt/flash/legato_logs