ewpa / LibSSH-ESP32

Libssh SSH client & server port to ESP32 Arduino library
https://www.ewan.cc/node/157
Other
265 stars 36 forks source link

add littlefs explanation #24

Open playmiel opened 1 year ago

playmiel commented 1 year ago

I tried to use libssh with littlefs with some modification and it works pretty well (test with an esp32 wrover) it would be necessary just to modify the examples

ewpa commented 1 year ago

Hello, thank you for your contribution. To be acceptable there would need to be some 'switch' so the invoker can decide if they wish to compile for spiffs or littlefs. There are other code changes present in the pull request that do not match the commit message. Please can you review this.

playmiel commented 1 year ago

okay I'll start working on it

playmiel commented 1 year ago

I will improve and make compatible the examples for littlefs maybe add some examples. if possible i will add a new example for a port forwarding

ewpa commented 1 year ago

I will wait while you work on this, then review. Please be careful about making platformio specific commits since Arduino is the main platform I use with this library.

playmiel commented 1 year ago

oh ok I use platformio mainly, is there a way for arduino ide to have a global define like platformio ?

ewpa commented 1 year ago

Using arduino-cli you can use something like --build-property="compiler.cpp.extra_flags=$MYFLAGS". for the IDE you would want something more transparent -- probably in the boards.txt. I've looked through the boards and cannot find any official esp32 boards with littlefs partitioning. They have only SPIFFS, FATFS or none. So I do not think littlefs is supported in Arduino for esp32 unless you can direct me otherwise?

playmiel commented 1 year ago

yes it is supported by the Arduino ide with this plugin https://github.com/me-no-dev/arduino-esp32fs-plugin and this one https://github.com/earlephilhower/mklittlefs/releases, I think it is still present the official esp32 because the end of the SPIFFS support is recent and it still works very well for a "simple" use of esp32. I will see how I could simplify the use of the littlefs with libssh for the arduino ide

ewpa commented 1 year ago

I found this official library which indicates littlefs uses the spiffs partition and mounts on VFS at a different location. So I believe the choice to use/format spiffs or littlefs should be down to the sketch/example and not the library.

ESP32-specific interfacing is in src/libssh_esp32_compat.c so this is the place to focus on. Below are the appropriate lines.

#ifndef LIBSSH_ESP32_COMPAT_HOMEDIR
#define LIBSSH_ESP32_COMPAT_HOMEDIR "/spiffs"
#endif

So, if you define LIBSSH_ESP32_COMPAT_HOMEDIR to "/littlefs" in PIO you could use littlefs versus spiffs without any library code change.

playmiel commented 1 year ago

yep with this -DLIBSSH_ESP32_COMPAT_HOMEDIR=\"/littlefs\" it work

ewpa commented 1 year ago

Hi Denis, please could you squash all commits into a single commit, cleanup/remove unrelated changes, move README comments about PIO into a clear section lower in the README, and update commit message to follow this repository's standards, i.e. MD. I think the PR is now just a change to a single file?

playmiel commented 1 year ago

hi, yes I will add before an example for port forwarding

ewpa commented 1 year ago

The example would be better in a new PR.

playmiel commented 1 year ago

ok I will clean it up, it has file "contributing.md" to see repository's standards?