How to edit custom logger_topics.txt

It could be an easy question.
I’m trying to read and write “etc/logging/logger_topics.txt” in sd card for customized logging.

But, I connect through mavlink console, I can’t find even the logging folder in etc.

I plugged in sd card in my laptop in order to make directory and file directly,
but it only shows log directory, dataman file, and some other text files.

Where and how can I read and write logger_topics.txt file?

Hi,

You have to create the folder and add the text file manually on the sd card.

1 Like

Where can I create the folder and add the text file?

In the mavlink console, mkdir command or editing file doesn’t work. (or I don’t know how to do)

In my laptop, I can’t see root folder such as etc, fs, obj, proc…
Or am I have to create etc/logging/logger_topics.txt in the place where I have shown above question?

@elton-choi:
The SD card is mounted to the path /fs/microsd/

In the startup script rcS, you should find the following that mounts the SD card (if it can be found)

#
# Try to mount the microSD card.
#
# REBOOTWORK this needs to start after the flight control loop
if mount -t vfat /dev/mmcsd0 /fs/microsd
then
	echo "[i] microSD mounted: /fs/microsd"
	if hardfault_log check
	then
		tone_alarm error
		if hardfault_log commit
		then
			hardfault_log reset
			tone_alarm stop
		fi
  else
    # Start playing the startup tune
    tone_alarm start
fi
...

If the SD card was mounted correctly, it will appear in the path /fs/microsd/. If you cd to this directory and run ls, you should see the contents of the SD card displayed.

If I am not mistaken you are only able to run mkdir on a path on your SD card, or on a path where there is a virtual file system that allows writing. The files that you see in /etc/ are stored directly in the STM32F4 flash, and are “read-only”.

I hope that makes some sense to you?

1 Like

Open the sd card with your computer, create the folder “etc”, in that folder create the folder “logging”. Then create a txt file named “logger_topics.txt”. In that file put the topics you want to log :slight_smile:

1 Like

Yes, you’re right. /fs/microsd/ area is only read-write available. mkdir command works there.
That’s the reason why I can only see /fs/microsd/ area in my laptop.

I have 2 more questions.

  1. how can I know some folders and files are in flash or eeprom? (folders and files in sd card is definite) and there is a way I can choose the physical location of some folders and files? or it is automatic?

  2. and is there a way I can view and edit some files through mavlink console? (of course, edit function is only availabe where write available)

Yes, you’re right. I misunderstood explanation of developer guide.
They write down the location etc/logging/logger_topics.txt “on sd card”.
(I’m confused with etc directory ^^;)
I have tested and make sure.

and I’m curious where basic logged topics are set even if I don’t customize my logger_topics.txt? They are set in the code? or something else?

The default topics are set here

1 Like

@elton-choi:

  • I don’t know if there is a way to tell if files are in the EEPROM or flash. I do know that the ROMFS is “mounted” to the the /etc/ path by NuttX. This is determined by the CONFIG_NSH_ROMFSMOUNTPT define in the Nuttx defconfig file. By changing this define, you can change the mount point of your ROMFS. See the extract from a defconfig below:
...
CONFIG_NSH_ROMFSMOUNTPT="/etc"
CONFIG_NSH_INITSCRIPT="init.d/rcS"
...

You can change the mount point of the SD card by changing the mount -t vfat /dev/mmcsd0 /fs/microsd line in the rcS file. You can change the fs/microsd path to whatever path you would like for mounting the SD card.

  • I don’t know if you can edit files via the mavlink console. Perhaps someone else knows whether this is possible.
1 Like