Skip to content

Commit 61dcedd

Browse files
authored
Update del_usb_source.py
1 parent 238eba9 commit 61dcedd

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tools/del_usb_source.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
def main(dir):
9-
109
s2_sdkconfig_path = os.path.join(dir, "esp32s2", "bin", "sdkconfig")
1110
if os.path.exists(s2_sdkconfig_path) == False:
1211
print("*** sdkconfig file for esp32s2 not found, no changes done ***")
@@ -15,19 +14,18 @@ def main(dir):
1514
with open(s2_sdkconfig_path) as src:
1615
line = src.readline()
1716
if line.startswith("# CONFIG_TINYUSB_ENABLED is not set"):
18-
print("*** removing USB Source code, since TinyUSB is disabled ***")
19-
rm -rf arduino-esp32/cores/esp32/esp32-hal-tinyusb.c
20-
rm -rf arduino-esp32/cores/esp32/esp32-hal-tinyusb.h
21-
rm -rf arduino-esp32/cores/esp32/USB.cpp
22-
rm -rf arduino-esp32/cores/esp32/USB.h
23-
rm -rf arduino-esp32/cores/esp32/USBCDC.cpp
24-
rm -rf arduino-esp32/cores/esp32/USBCDC.h
25-
rm -rf arduino-esp32/cores/esp32/USBMSC.cpp
26-
rm -rf arduino-esp32/cores/esp32/USBMSC.h
27-
28-
rm -rf arduino-esp32/libraries/USB
29-
30-
return 0
17+
print("*** TinyUSB is disabled, removing not needed USB Source code ***")
18+
os.remove("arduino-esp32/cores/esp32/esp32-hal-tinyusb.c")
19+
os.remove("arduino-esp32/cores/esp32/esp32-hal-tinyusb.h")
20+
os.remove("arduino-esp32/cores/esp32/USB.cpp")
21+
os.remove("arduino-esp32/cores/esp32/USB.h")
22+
os.remove("arduino-esp32/cores/esp32/USBCDC.cpp")
23+
os.remove("arduino-esp32/cores/esp32/USBCDC.h")
24+
os.remove("arduino-esp32/cores/esp32/USBMSC.cpp")
25+
os.remove("arduino-esp32/cores/esp32/USBMSC.h")
26+
shutil.rmtree("arduino-esp32/libraries/USB", ignore_errors=True)
27+
return 0
28+
return
3129

3230

3331
if __name__ == "__main__":

0 commit comments

Comments
 (0)