|  | @@ -98,12 +98,13 @@ void onListFiles(const char * dir_name) {
 | 
	
		
			
				|  |  |      FsFile dir;
 | 
	
		
			
				|  |  |      FsFile file;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    memset(scsiDev.data, 0, 4096);
 | 
	
		
			
				|  |  | +    memset(scsiDev.data, 0, ENTRY_SIZE * (MAX_FILE_LISTING_FILES + 1));
 | 
	
		
			
				|  |  |      char name[MAX_FILE_PATH] = {0};
 | 
	
		
			
				|  |  | -    dir.open(dir_name);
 | 
	
		
			
				|  |  | -    dir.rewindDirectory();
 | 
	
		
			
				|  |  |      uint8_t index = 0;
 | 
	
		
			
				|  |  |      byte file_entry[ENTRY_SIZE] = {0};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    dir.open(dir_name);
 | 
	
		
			
				|  |  | +    dir.rewindDirectory();
 | 
	
		
			
				|  |  |      while (file.openNext(&dir, O_RDONLY))
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          memset(name, 0, MAX_FILE_PATH);
 | 
	
	
		
			
				|  | @@ -130,6 +131,7 @@ void onListFiles(const char * dir_name) {
 | 
	
		
			
				|  |  |          file_entry[39] = (size) & 0xff;
 | 
	
		
			
				|  |  |          memcpy(&(scsiDev.data[ENTRY_SIZE * index]), file_entry, ENTRY_SIZE);
 | 
	
		
			
				|  |  |          index = index + 1;
 | 
	
		
			
				|  |  | +        if (index >= MAX_FILE_LISTING_FILES) break;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      dir.close();
 | 
	
		
			
				|  |  |  
 |