Change logger file save location

How do I change where the logger files are being saved? Right now they’re being saved at \home\linaro\log and I would like them to be saved on my sd card \mnt\sdcard\

Hi

This path is hardcoded in px4_defines.h. You can either change it in there, or better, change the log directory into a symbolic link to point to the sd card.

1 Like

Hey, I changed the log file directory to "/mnt/sdcard" instead of /root in the sdlog2.c file.

But PX4 doesn’t detect the microSD card to log into it. This is what I get when I start PX4:

root@linaro-developer:/home/linaro# ./px4 mainapp.config 
sh: 1: cannot create /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Directory nonexistent
commands file: mainapp.config

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

WARN  [sdlog2] [blackbox] no microSD card, disabling logging
Command 'sdlog2' failed, returned 1
INFO  [dataman] Unkown restart, data manager file '/home/linaro/dataman' size is 47640 bytes
INFO  [mavlink] mode: Normal, data rate: 1000000 B/s on udp port 14556 remote port 14550
Sleeping for 1 s; (1000000 us).
pxh> INFO  [mavlink] using network interface wlan0, IP: 192.168.0.114
INFO  [mavlink] with broadcast IP: 192.168.0.255

pxh> 

But the microSD is listed when I run the " df " command in the terminal:

root@linaro-developer:/# df
Filesystem      1K-blocks    Used Available Use% Mounted on
/dev/mmcblk0p13   8238556 1426340   6812216  18% /
udev               781328       4    781324   1% /dev
tmpfs              192552     492    192060   1% /run
none                    4       0         4   0% /sys/fs/cgroup
none                 5120       0      5120   0% /run/lock
none               962744       0    962744   0% /run/shm
none               102400       0    102400   0% /run/user
/dev/mmcblk0p14     32212    4116     28096  13% /mnt/persist
/dev/mmcblk0p15     32212   14800     17412  46% /lib/firmware
/dev/mmcblk1p1   30295900  577248  28200060   3% /mnt/sdcard
/dev/mmcblk0p12   1030828   45388    985440   5% /mnt/system
root@linaro-developer:/# 

Could anyone please point me in the right direction?

Hey, I got it. A very silly mistake on my part. Basically, this is what you need to do.

go to "src/modules/sdlog2" and edit the sdlog2.c file. go to line 163 and do this:

#ifndef __PX4_POSIX_EAGLE
#define MOUNTPOINT PX4_ROOTFSDIR"/fs/microsd"
#else
#define MOUNTPOINT "/mnt/sdcard"

that should do the trick. This is what I get when I start PX4 now :

root@linaro-developer:/home/linaro# ./px4 mainapp.config 
sh: 1: cannot create /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor: Directory nonexistent
commands file: mainapp.config

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [sdlog2] [blackbox] /mnt/sdcard/log/2016-12-10
INFO  [sdlog2] [blackbox] recording: 18_19_54.px4log
INFO  [dataman] Unkown restart, data manager file '/home/linaro/dataman' size is 47640 bytes
INFO  [mavlink] mode: Normal, data rate: 1000000 B/s on udp port 14556 remote port 14550
Sleeping for 1 s; (1000000 us).
pxh> INFO  [mavlink] using network interface wlan0, IP: 192.168.0.114
INFO  [mavlink] with broadcast IP: 192.168.0.255

pxh> 

Hope that resolves the issue. :slight_smile:

1 Like