2024-12-11 18:23:05 +01:00
|
|
|
#!/usr/bin/env micropython
|
|
|
|
|
|
|
|
LOG_PATH = os.path.join(os.getenv("HOME", "/tmp"), ".fuse.log")
|
|
|
|
file1 = "hello world"
|
|
|
|
|
|
|
|
def log(msg): open(LOG_PATH, "a").write(msg + "\n")
|
2025-01-09 12:14:26 +01:00
|
|
|
def getattr(path): return {"16877 2 0 0 4096 8" if path == "/" else f"33188 1 0 0 {len(file1)} 1"} if path in ["/", "/file1"] else None
|
2024-12-11 18:23:05 +01:00
|
|
|
def readdir(): print("file1")
|
|
|
|
def read(path): print(file1) if path == "/file1" else sys.exit(1)
|
|
|
|
|
|
|
|
log(" ".join(sys.argv))
|
|
|
|
if len(sys.argv) < 2: sys.exit(1)
|
|
|
|
cmd, path = sys.argv[1], sys.argv[2] if len(sys.argv) > 2 else None
|
|
|
|
if cmd == "readdir": readdir()
|
|
|
|
elif cmd == "getattr": print(getattr(path)) if getattr(path) else sys.exit(1)
|
|
|
|
elif cmd == "read": read(path)
|
|
|
|
else: sys.exit(1)
|