added mountpoint checks

This commit is contained in:
Daniel Dakhno 2022-09-16 02:58:48 +02:00
parent a1dfb11fc7
commit cfc2d8688b
2 changed files with 18 additions and 6 deletions

View File

@ -5,13 +5,11 @@ This driver allows you to mount the flipper zero over its serial connection and
## Installation ## Installation
``` ```
git clone --recursive --depth 1 git@github.com:dakhnod/fzfs.git git clone --recursive git@github.com:dakhnod/fzfs.git
cd fzfs cd fzfs
python3 -m venv venv python3 -m venv venv
. venv/bin/activate . venv/bin/activate
pip install protobuf pip install protobuf fusepy pyserial numpy
pip install fusepy
pip install pyserial
``` ```
## Usage ## Usage

18
fzfs.py
View File

@ -10,13 +10,27 @@ import logging
import time import time
import threading import threading
import stat import stat
import os
def main(): def main():
print('starting') if len(sys.argv) != 3:
print('usage: python fzfs.py serial-device mountpoint')
print('example: python fzfs.py /dev/ttyACM0 /home/user/flipper-zero')
return
mountpoint = sys.argv[2]
if not os.path.isdir(mountpoint):
print('mountpoint must be an empty folder')
return
if len(os.listdir(mountpoint)) != 0:
print('mountpoint must be an empty folder')
return
try: try:
fs = fuse.FUSE(FlipperZeroFileSysten(sys.argv[1]), sys.argv[2], foreground=True) fs = fuse.FUSE(FlipperZeroFileSysten(sys.argv[1]), sys.argv[2], foreground=True)
except: except:
print('stopping')
fuse.fuse_exit() fuse.fuse_exit()