yangsong8-a1 commented on issue #15960:
URL: https://github.com/apache/nuttx/issues/15960#issuecomment-2712456804

   @SPRESENSE Based on this patch https://github.com/apache/nuttx/pull/15931,  
I tested it in sim:usbdev and esp32s3-devkit:usb_device for about 11 hours. 
Then I analyzed the output log and found no problems. 
   
   This python script will remove duplicate content and keep a copy of the 
first occurrence in the output file.
   ```
     1 def remove_duplicate_lines_with_line_numbers(input_file, output_file):
     2     # save line number
     3     lines = []
     4     seen_lines = {}
     5     
     6     with open(input_file, 'r') as f:
     7         for i, line in enumerate(f, start=1):
     8             stripped_line = line.strip()
     9             lines.append((line, i))
    10     
    11     unique_lines = []
    12     for line, line_number in lines:
    13         stripped_line = line.strip()
    14         if stripped_line:
    15             if stripped_line not in seen_lines:
    16                 seen_lines[stripped_line] = line_number
    17                 unique_lines.append((line, line_number))
    18         else:
    19             unique_lines.append((line, line_number))  # keep space line
    20     
    21     # Write unique lines to the output file and label them with line 
numbers
    22     with open(output_file, 'w') as f:
    23         for line, line_number in unique_lines:
    24             stripped_line = line.strip()
    25             if stripped_line:
    26                 f.write(f"Line {line_number}: {line}")
    27             else:
    28                 f.write(line)  # keep space line                         
                                                                                
                                                                                
                                             
    29 
    30 if __name__ == "__main__":
    31     input_file = "cdcacm_esp32.log"
    32     output_file = "esp32_py_enhance.txt"
    33     remove_duplicate_lines_with_line_numbers(input_file, output_file)
   ```
   
   Did you compile the project using the spresense:rndis_composite 
configuration?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to