Read the log file backend FS

Hello Nordic team, 

I want to be able to save the log into a file and then read it in order to send it's content via HID.

I've managed to make the log back end FS work (I can see the file's size increasing).

But when I want to read it's content I get an hard fault.

I think I need to stop the log to be written to the file before reading it.

Is there a way to do so or a specific function for this case ? 

I didn't find anything yet on zephyr repo neither on the devzone Q&A.

Thanks in advance.

Martin.

Parents
  • But when I want to read it's content I get an hard fault.

    I think I need to stop the log to be written to the file before reading it.

    I think it sounds reasonable that you should close the file before reading it. Maybe you need to even switch between writing and reading, and have some buffers where you can store data intermittently. Maybe you can also create several files, such that you can read files that are currently not being written to. I don't have any good pointers here, this is very much up how you have made the log backend write to the file system in the first place, but I think you are on the right path on how I would have solved it at least.

    Kenneth

Reply
  • But when I want to read it's content I get an hard fault.

    I think I need to stop the log to be written to the file before reading it.

    I think it sounds reasonable that you should close the file before reading it. Maybe you need to even switch between writing and reading, and have some buffers where you can store data intermittently. Maybe you can also create several files, such that you can read files that are currently not being written to. I don't have any good pointers here, this is very much up how you have made the log backend write to the file system in the first place, but I think you are on the right path on how I would have solved it at least.

    Kenneth

Children
Related