diff --git a/README.rst b/README.rst index 461b1f7..5251f65 100644 --- a/README.rst +++ b/README.rst @@ -11,7 +11,8 @@ Rquirements * Python 2.7 * ``adb`` installed and in ``$PATH`` or provided via the config file * An Android device or emulator preferably rooted -* Busybox installed and available in the path on the device +* ``busybox`` (``toolbox``, ``toybox``) installed and available in the path on + the device Make sure, that issuing from command line: @@ -82,14 +83,14 @@ where: everything (slow!) * ``suppress_colors`` this option will make ``busybox`` not to display colors, helpful, if ``busybox ls`` is configured to display colors by default. Does - not affect ``toolbox``. + not affect ``toolbox`` or ``toybox``. * ``root`` root directory to read. Everything outside of that directory will be omitted. That would be the fastest way to access certain location on the device. Note, that ``dirs_to_skip`` still apply inside this directory. * ``adb_command`` absolute or relative path to ``adb`` command. `~/` or environment variables are allowed. * ``adb_connect`` specifies if connection to specific device needs to be - performed before accessing shell. It is usefull for *adb over network* + performed before accessing shell. It is useful for *adb over network* feature. Typical value here is a device IP address with optional port, which defaults to 5555. diff --git a/adbfs b/adbfs index 4df0b66..f3d03ee 100755 --- a/adbfs +++ b/adbfs @@ -48,7 +48,17 @@ class Conf(object): r'(?P\d+)?\s' r'(?P\d{4}-\d{2}-\d{2}\s' r'\d{2}:\d{2})\s' - r'(?P.*)'}} + r'(?P.*)'}, + 'toybox': {'ls': 'toybox ls -anl', + 'rls': 'toybox ls -Ranl {}', + 'file_re': r'^(?P[-bcdlps][-rwxsStT]{9})\s+' + r'(?P\d+)\s+' + r'(?P\d+)\s+' + r'(?P\d+)\s+' + r'(?P\d+)?\s' + r'(?P\d{4}-\d{2}-\d{2}\s' + r'\d{2}:\d{2})\s' + r'(?P.*)'}} def __init__(self): self.box = None @@ -81,6 +91,18 @@ class Conf(object): except subprocess.CalledProcessError: pass + try: + with open(os.devnull, 'w') as fnull: + result = subprocess.check_output(cmd + ['toybox'], + stderr=fnull) + + if 'toybox' in result: + self.box = Conf.boxes['toybox'] + Adb.file_re = re.compile(self.box['file_re']) + return + except subprocess.CalledProcessError: + pass + try: with open(os.devnull, 'w') as fnull: result = subprocess.check_output(cmd + ['toolbox'],