Skip to content

Commit f816944

Browse files
authored
Update del_usb_source.py
1 parent 595a322 commit f816944

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

tools/del_usb_source.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,31 @@
55

66

77
def check_entry_s2_sdkconfig():
8-
s2_sdkconfig_path = join("$PROJECT_DIR", "esp32s2", "bin", "sdkconfig")
8+
9+
10+
def main(dir):
11+
12+
s2_sdkconfig_path = os.path.join(dir, "esp32s2", "bin", "sdkconfig")
913
if os.path.exists(s2_sdkconfig_path) == False:
10-
print("*** sdkconfig file for esp32s2 not found, no changes will be done ***")
14+
print("*** sdkconfig file for esp32s2 not found, no changes done ***")
1115
return
1216

1317
with open(s2_sdkconfig_path) as src:
1418
line = src.readline()
1519
if line.startswith("# CONFIG_TINYUSB_ENABLED is not set"):
1620

17-
return
21+
return 0
22+
23+
24+
if __name__ == "__main__":
25+
parser = argparse.ArgumentParser()
26+
parser.add_argument(
27+
"-d",
28+
"--dir",
29+
dest="dir",
30+
required=True,
31+
help="Directory folder where the esp32-s2 'sdkonfig' file is located",
32+
)
33+
args = parser.parse_args()
34+
35+
sys.exit(main(args.dir))

0 commit comments

Comments
 (0)