diff --git a/sys/fs/fat/fat.c b/sys/fs/fat/fat.c index d77733e..4d94a80 100644 --- a/sys/fs/fat/fat.c +++ b/sys/fs/fat/fat.c @@ -118,8 +118,19 @@ } -int write_fat() { - return(0); +int write_fat(fileDescriptor_t *fd, char *data, uInt32 offset, long size) { + FL_FILE *_file = (FL_FILE*) fd->res; + + kprintf("Writing: %i[%i]\n", size, offset); + fl_fseek(_file, offset, 0); + + if (fl_fwrite(data, 1, size, _file) != size) + kprintf("ERROR: Write file failed\n"); + + kprintf("Wrote: %i\n", size); + + /* Return */ + return (size); } int open_fat(const char *file, fileDescriptor_t *fd) { diff --git a/sys/fs/fat/fat_access.c b/sys/fs/fat/fat_access.c index aaa6f41..2182695 100644 --- a/sys/fs/fat/fat_access.c +++ b/sys/fs/fat/fat_access.c @@ -405,7 +405,6 @@ #if FATFS_INC_LFN_SUPPORT if (fatfs_entry_lfn_text(directoryEntry)) { // Long File Name Text Found - kprintf("DB[%s:%i]", __FILE__, __LINE__); fatfs_lfn_cache_entry(&lfn, fs->currentsector.sector + recordoffset); } else if (fatfs_entry_lfn_invalid(directoryEntry)) { // If Invalid record found delete any long file name information collated @@ -415,9 +414,6 @@ } else if (fatfs_entry_lfn_exists(&lfn, directoryEntry)) { // Normal SFN Entry and Long text exists long_filename = fatfs_lfn_cache_get(&lfn); - kprintf("DB[%s:%i] directoryEntry->Name: %s\n", __FILE__, __LINE__, directoryEntry->Name); - kprintf("DB[%s:%i] directoryEntry->Attr: 0x%X\n", __FILE__, __LINE__, directoryEntry->Attr); - kprintf("DB[%s:%i] directoryEntry->FileSize: %i\n", __FILE__, __LINE__, directoryEntry->FileSize); // Compare names to see if they match if (fatfs_compare_names(long_filename, name_to_find)) { @@ -430,7 +426,6 @@ else { #endif if (fatfs_entry_sfn_only(directoryEntry)) { // Normal Entry, only 8.3 Text - kprintf("DB[%s:%i]", __FILE__, __LINE__); memset(short_filename, 0, sizeof(short_filename)); // Copy name to string @@ -458,7 +453,6 @@ // Compare names to see if they match if (fatfs_compare_names(short_filename, name_to_find)) { - kprintf("gfe[%s:%i]: %s:%s\n", __FILE__, __LINE__, short_filename, name_to_find); memcpy(sfEntry, directoryEntry, sizeof(struct fat_dir_entry)); return 1; } @@ -576,6 +570,7 @@ return 1; } #endif + //------------------------------------------------------------- // fatfs_update_file_length: Find a SFN entry and update it // NOTE: shortname is XXXXXXXXYYY not XXXXXXXX.YYY