fix nffs_inode_read_filename does not update out_full_len
This commit is contained in:
1 parent
f6a66d444a
commit
48718392c3
6 files changed
+59
-12
No files matched your search
@@ -163,9 +163,9 @@ void dbgMemInfo(void)
|
||||
void dbgPrintVersion(void)
|
||||
{
|
||||
Serial.println();
|
||||
Serial.println("BSP Library: " ARDUINO_BSP_VERSION);
|
||||
Serial.printf ("Firmware : %s\n", getFirmwareVersion());
|
||||
Serial.printf ("Serial No : %s\n", getMcuUniqueID());
|
||||
Serial.println("BSP Library : " ARDUINO_BSP_VERSION);
|
||||
Serial.printf ("Firmware : %s\n", getFirmwareVersion());
|
||||
Serial.printf ("Serial No : %s\n", getMcuUniqueID());
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
||||
@@ -379,8 +379,10 @@ void AdafruitBluefruit::printInfo(void)
|
||||
// Skip if Bluefruit.begin() is not called
|
||||
if ( _ble_event_sem == NULL ) return;
|
||||
|
||||
const char* title_fmt = "%-15s: ";
|
||||
|
||||
// Name
|
||||
Serial.printf("%-15s ", "Name");
|
||||
Serial.printf(title_fmt, "Name");
|
||||
{
|
||||
char name[32];
|
||||
memclr(name, sizeof(name));
|
||||
@@ -390,13 +392,13 @@ void AdafruitBluefruit::printInfo(void)
|
||||
Serial.println();
|
||||
|
||||
// Max Connections
|
||||
Serial.printf("%-15s ", "Max Connection");
|
||||
Serial.printf(title_fmt, "Max Connection");
|
||||
Serial.printf("Peripheral = %d, ", _prph_enabled ? 1 : 0);
|
||||
Serial.printf("Central = %d, ", _central_enabled ? BLE_CENTRAL_MAX_CONN : 0);
|
||||
Serial.println();
|
||||
|
||||
// Address
|
||||
Serial.printf("%-15s ", "Address");
|
||||
Serial.printf(title_fmt, "Address");
|
||||
{
|
||||
const char* type_str[] = { "Public", "Static", "Private Resolvable", "Private Non Resolvable" };
|
||||
uint8_t mac[6];
|
||||
@@ -406,16 +408,16 @@ void AdafruitBluefruit::printInfo(void)
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
Serial.printf("%-15s ", "TX Power");
|
||||
Serial.printf(title_fmt, "TX Power");
|
||||
Serial.printf("%d dBm", _tx_power);
|
||||
Serial.println();
|
||||
|
||||
Serial.printf("%-15s ", "Conn Intervals");
|
||||
Serial.printf(title_fmt, "Conn Intervals");
|
||||
Serial.printf("min = %.2f ms, ", _ppcp_min_conn*1.25f);
|
||||
Serial.printf("max = %.2f ms", _ppcp_max_conn*1.25f);
|
||||
Serial.println();
|
||||
|
||||
Serial.printf("%-15s ", "Paired Devices");
|
||||
Serial.printf(title_fmt, "Paired Devices");
|
||||
Serial.printf("TODO");
|
||||
Serial.println();
|
||||
|
||||
|
||||
@@ -199,3 +199,39 @@ bool ApacheNffs::testFolder(const char* path)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Debug
|
||||
*------------------------------------------------------------------*/
|
||||
void dbgPrintDir(const char* cwd)
|
||||
{
|
||||
// Open the input folder
|
||||
NffsDir dir(cwd);
|
||||
|
||||
// File Entry Information which hold file attribute and name
|
||||
NffsDirEntry dirEntry;
|
||||
|
||||
Serial.println(cwd);
|
||||
|
||||
// Loop through the directory
|
||||
while( dir.read(&dirEntry) )
|
||||
{
|
||||
Serial.print("|_ ");
|
||||
|
||||
char eName[64];
|
||||
dirEntry.getName(eName, sizeof(eName));
|
||||
|
||||
if ( dirEntry.isDirectory() )
|
||||
{
|
||||
Serial.print( eName );
|
||||
Serial.println("/");
|
||||
}else
|
||||
{
|
||||
NffsFile file(cwd, dirEntry, FS_ACCESS_READ);
|
||||
Serial.printf("%-30s %d Bytes\n", eName, file.size() );
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
dir.close();
|
||||
}
|
||||
@@ -53,6 +53,12 @@ NffsFile::NffsFile(const char* path, uint8_t flags)
|
||||
open(path, flags);
|
||||
}
|
||||
|
||||
NffsFile::NffsFile(const char* parent_dir, NffsDirEntry& dirent, uint8_t flags)
|
||||
{
|
||||
_init();
|
||||
open(parent_dir, dirent, flags);
|
||||
}
|
||||
|
||||
NffsFile::~NffsFile()
|
||||
{
|
||||
if (_file) close();
|
||||
@@ -79,7 +85,7 @@ bool NffsFile::open(const char* parent_dir, NffsDirEntry& dirent, uint8_t flags)
|
||||
|
||||
if ( dirent.getName(name+len, NFFS_FILENAME_MAX_LEN+1-len) > 0 )
|
||||
{
|
||||
result = open(name);
|
||||
result = open(name, flags);
|
||||
}
|
||||
|
||||
rtos_free(name);
|
||||
|
||||
@@ -49,9 +49,9 @@ public:
|
||||
int errnum;
|
||||
|
||||
NffsFile(void);
|
||||
virtual ~NffsFile();
|
||||
|
||||
NffsFile(const char* path, uint8_t flags = FS_ACCESS_READ);
|
||||
NffsFile(const char* parent_dir, NffsDirEntry& dirent, uint8_t flags = FS_ACCESS_READ);
|
||||
virtual ~NffsFile();
|
||||
|
||||
bool open(const char* path, uint8_t flags = FS_ACCESS_READ);
|
||||
bool open(const char* parent_dir, NffsDirEntry& dirent, uint8_t flags = FS_ACCESS_READ);
|
||||
|
||||
@@ -775,6 +775,9 @@ nffs_inode_read_filename(struct nffs_inode_entry *inode_entry, size_t max_len,
|
||||
|
||||
out_name[read_len] = '\0';
|
||||
|
||||
// Adafruit fix
|
||||
*out_full_len = (uint8_t) read_len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user