项目作者: nopnop2002

项目描述 :
SMB client example for esp-idf
高级语言: C
项目地址: git://github.com/nopnop2002/esp-idf-smb-client.git
创建时间: 2021-05-25T07:41:27Z
项目社区:https://github.com/nopnop2002/esp-idf-smb-client

开源协议:MIT License

下载


esp-idf-smb-client

SMB client example for esp-idf.
“SMB (Server Message Block)” is a standard file sharing protocol in Windows networks.
You can access Windows shared folder from esp32.
This project use SMB2/3 userspace client.

Software requirements

ESP-IDF V5.0 or later.
ESP-IDF V4.4 release branch reached EOL in July 2024.

Installation

  1. git clone https://github.com/nopnop2002/esp-idf-smb-client
  2. cd esp-idf-smb-client
  3. git clone https://github.com/sahlberg/libsmb2 -b libsmb2-6.2 components/libsmb2
  4. cp esp-idf/CMakeLists.txt components/libsmb2/
  5. cd smb2-ls
  6. idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3/esp32c6}
  7. idf.py menuconfig
  8. idf.py flash

Configuration

You have to set this config value with menuconfig.

  • CONFIG_ESP_WIFI_SSID
    SSID (network name) to connect to.
  • CONFIG_ESP_WIFI_PASSWORD
    WiFi password (WPA or WPA2) to use.
  • CONFIG_ESP_MAXIMUM_RETRY
    Set the Maximum retry to avoid station reconnecting to the AP unlimited when the AP is really inexistent.
  • CONFIG_SMB_USER
    Username with shared folder permissions.
  • CONFIG_SMB_NEED_PASSWORD
    Shared access requires password.
  • CONFIG_SMB_PASSWORD
    Password with shared folder permissions.
  • CONFIG_SMB_HOST
    IP address or mDNS host name of shared host.
  • CONFIG_SMB_PATH
    Shared path name.

config-main
config-app-1

When a password is required to access the shared folder.

config-app-2

Specify the SMB Host in one of the following formats.

  • IP address like 192.168.10.120
  • mDNS hostname like smbhost.local

config-app3

Examples

  • smb2-ls
    Shared directory file list

  • smb2-cat
    Read from a file in a shared directory

  • smb2-put
    Write to a file in a shared directory

  • smb2-stat
    Obtain file information in a shared directory

  • smb2-mkdir
    Create directory in a shared directory

smbclient

You can check the services provided by the host using smbclient.

  1. $ smbclient -L LANDISK-HDL-AA1.local -U admin
  2. Enter WORKGROUP\admin's password:
  3. Sharename Type Comment
  4. --------- ---- -------
  5. LAN DISK Log Disk HDL-AA Share for Log files
  6. disk1 Disk HDL-AA RAID share
  7. IPC$ IPC IPC Service (HDL-AA series)
  8. SMB1 disabled -- no workgroup available