GithubHelp home page GithubHelp logo

aafm's Introduction

aafm

Android ADB File Manager

A command line + GUI (GTK based) Android ADB-based file manager

Screenshot

Recent Android releases (Honeycomb / 3.0+) replace the older USB mount protocol with the use of MTP (Massive Transfer Protocol). Unfortunately this is still very buggy and doesn't work as it should in any machine I have tested (and heard of): system slowing down to a halt when transferring large number of files, files which are there but cannot be seen by the computer... etc.

So I decided to go ahead and build a little utility that would if not fix, at least alleviate the pain of using Honeycomb devices. aafm uses ADB (one of the command line tools provided with the official Android SDK) for communicating with the Android device. This is the same method that IDEs implement.

Installing

Requirements

Python with PyGTK bindings, GTK, git, and the Android SDK.

Getting these should be fairly straightforward if you're running any decent Linux distribution. If you're using Windows I believe there are next-next-next installers for everything. This leaves us with the third option which is Mac OS. Up until recently there wasn't an easy way to get any PyGTK software working in Mac OS, but turns out you can now download a binary build of PyGTK for Mac OS with which aafm works quite well!

It can be downloaded from http://afb.users.sourceforge.net/zero-install/PyGTK.pkg (more info). Simply run the installer once downloaded, and then follow the instructions below as if you were running a proper Linux system.

One note though: there are a few hiccups with the Mac version, but they are mostly cosmetic and won't prevent you from enjoying the software. Feel free to help correcting them if you have the know-how!

Clone repository

Clone this repository to a place you fancy. For example, your Applications folder.

git clone git://github.com/sole/aafm.git ~/Applications/aafm

Install the Android SDK

If it's not installed yet, download the SDK from its page and follow its instructions: http://developer.android.com/sdk/index.html

Basically (at least in Linux) just download a zip file and unpack it to a known location. In my case it's ~/Applications/android-sdk-linux_86. Once that is done, you need to make sure that the ADB tool is readily accessible from a shell (which is what aafm uses internally).

So to try that out, open a new terminal and type adb. If it works, you should get a long help message that starts with something like Android Debug Bridge version 1.0.26. If it doesn't work, you'll get something akin to adb: command not found.

In case it doesn't work, you need to add the path to ADB to the environment PATH variable. In Linux this is done by editing a file called .bashrc in your home folder (.bash_profile in Mac OS). Locate a line that looks like PATH=$PATH and make it look like this:

PATH=$PATH:~/Applications/android-sdk-linux_86/platform-tools

The line above appends ADB's path to whatever value $PATH held before. The path might be different, according to wherever you've installed the Android SDK.

For more information on ADB and a list of its features, read over here: http://developer.android.com/guide/developing/tools/adb.html

Also, I haven't tried it myself, but it seems that it's possible to download and build a reduced subset of the Android SDK only, including ADB and a few more tools. This doesn't require Java installed in the system. This page describes how: http://lackingrhoticity.blogspot.com/2010/02/how-to-build-adb-android-debugger.html

Close terminal and open it again

So the changes to the PATH get current. In Mac OS you might need to log in and out too.

Configure udev rules (if in Linux)

You need to let the system know that when you connect your USB device (i.e. the tablet) it should allow you, as a non-root user, to access it. If you don't do that, you'll get a "Insufficient permissions for device" error.

This is done by adding a new file that contains so called udev rules.

For example, in Ubuntu 10.10 you would add a file in /etc/udev/rules.d/51-android.rules with the following content:

# Samsung
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0777"

You can find out the "idVendor" value by running lsusb in a terminal. That will output a list of the currently connected USB devices, such as for example this:

Bus 004 Device 006: ID 05ac:8218 Apple, Inc. 
Bus 004 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 004 Device 002: ID 05ac:0237 Apple, Inc. Internal Keyboard/Trackpad (ISO)
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 18d1:4e12 Google Inc. Nexus One Phone (Debug)
Bus 001 Device 002: ID 05ac:8507 Apple, Inc. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Since I'd like to add support for browsing my Nexus One phone (because aafm works with every Android device that adb can connect to), I just need to look at the device with id 18d1:4e12, and add the following line to the udev rules file:

SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"

Save it, and then change the file permissions:

chmod a+r /etc/udev/rules.d/51-android.rules

To make sure it worked, connect the device and try to run adb devices in a terminal. If it's working properly, you should see a list more or less like this:

List of devices attached 
4342354131444B534652	device

The numbers aren't important, the important bit is that you see device instead of ??????.

If it isn't, you might need to either disconnect the device and try again, or reload udev so that the rules are actually loaded. Try with this:

sudo /etc/init.d/udev restart

If everything else fails, try to log in and out again, or maybe even restart the system.

More information on udev rules and Android can be found on the official Android development guide: http://developer.android.com/guide/developing/device.html

Enable Debug mode in the device

Go to Settings → Applications → Development and make sure the USB debugging checkbox is ticked. You might get a scary warning saying debugging allows you to do nasty things--just ignore it.

Execute aafm

To execute it, cd to the place where it's been cloned:

cd ~/Applications/aafm/src/

And simply execute it:

./aafm-gui.py

If for some odd reason it has lost the executable permission, you can add it:

chmod +x ./aafm-gui.py

Or simply execute it using Python:

python ./aafm-gui.py

Once you're satisfied it's working, you can also make a launcher or add it to your Gnome menu, of course!

Using it

If everything works (and why shouldn't it?) you should get a window divided in two panels. The left side represents your host computer, and initially should show the files of the aafm directory, since you launched it from there. The right side represents your Android device's files --so it needs to be connected to the computer, and USB debugging must be enabled in the device. You can navigate just as you would do with your favourite file explorer. Files can be dragged from one to another panel, directories created, and files renamed (hint: right click and explore the options the contextual menu offers you!). You can also drag from Nautilus (in GNOME) into the device panel, to copy files to the device, or drag to Nautilus, for copying files from the device.

Be warned that currently the progress reporting is a bit hackish and with large files it will appear as if the window has got frozen. It hasn't--it's just waiting for the ADB transfer to finish. In the future this should be fixed, but I haven't come up with the best solution yet.

License

Copyright (C) 2011-2012 Soledad Penades (http://soledadpenades.com).

This software is licensed under a GPL V3 license. Please read the accompanying LICENSE.txt file for more details, but basically, if you modify this software and distribute it, you must make your changes public too, so that everyone can benefit from your work--just as you're doing with mine.

You can also make your changes public even if you don't plan on redistributing this application, okay? Sharing is good! :-)

Change log

2012 09 25 - r5

Several bug fixes and refactoring, plus a nice addition for those using desktop systems in Linux!

  • New .desktop file and icon allows users to launch aafm from GNOME/KDE/etc menus/shells/launchers (Huulivoide). Fixes #35.
  • New setup.py script for making aafm available system-wide (Huulivoide). Fixes #35.
  • Fix/refactor copying files between host and device (sole, xisberto). Fixes #33 and #37.
  • Gracefully handle unknown uids and gids (sole and muflone). Fixes #8 and #39.

2012 03 14 - r4

Many interesting bug fixes and new features thanks to the work of Norman Rasmussen and Michał Kowalczuk. Thanks!

  • Add BusyBox support (by sammael). Fixes #11.
  • Handle device drops when there's no row present (by normanr). Fixes #9.
  • Handle symlinks on the device correctly (by normanr). Fixes #12.
  • Quote/Unquote special characters in drag&drop messages (by normanr). Fixes #10.
  • Slightly improve the README. Clarify how to find out the device Id, add link to PyGTK binary for Mac users.
  • Move the TO DO list items that were on this README file over to the issue tracker in the project's page.

2011 11 06 - r3

  • Fix issue #4: use correct path separator in device when running under Windows
  • Fix issue #5: support for finding out ownership in Windows
  • Python 3 compatibility
  • Start using REVISION file
  • README.md revised

2011 09 30 - r2

  • Fix issue #3: ls -la fails in some devices

2011 07 18 - r1

  • First initial release; basic functionality is here!

Attributions

Hacking

I'm by no means a GTK/Python/ADB/Android expert. I'm just learning so this project will surely contain many things that can be improved or that are plain wrong, so feel free to clone the repository and submit pull requests :-)

In order to make your life a bit easier I'll roughly show what each file does:

  • Aafm.py - a class that communicates with an Android device, using ADB via shell commands. Takes care of copying and reading files, listing and parsing directories, etc.
  • aafm-gui.py - this is the GTK front-end. Takes care of building the window with the host and device panels, and issuing instructions to Aafm when the user requests something to be done.
  • TreeViewFile.py - a utility class that encapsulates a GTKTreeView and some more things in order to show file listings.
  • MultiDragTreeView.py - an awesome class developed by the guys of Quod Libet, that allows more than one element of a TreeView to be selected and dragged around.

As you can see, an aafm-cli.py GUI counterpart is missing. There was one at the beginning but I didn't redo it when I rewrote most of the code from scratch. Feel free to... you know what, if you're interested in having a CLI version.

This was initially developed in an Ubuntu Linux 10.10 system. I thought it wouldn't work on other systems, but it seems people are using it in a lot of places though. Some environments where it's known to work:

  • Ubuntu 10.10, 11.04, 11.10
  • Arch Linux
  • Windows (!!!)

TO DO

I'm now using Github's issue tracker to keep track of issues, bugs and wished-for features.

If you'd like to have a certain feature or think you've found a bug that is not in the list, please add it to the issue tracker at https://github.com/sole/aafm/issues

aafm's People

Contributors

huulivoide avatar muflone avatar sole avatar thp avatar tslocum avatar xisberto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aafm's Issues

No Permission problem

I'm running aafm on a Galaxy tab 2.0 7".

If I try to copy a file to the installed sd card I get the following:

EXECUTE= adb shell ls -l -a /mnt/extSdCard/Music/
EXECUTE= adb push "/home/bob/Music/jazz-collections/25 Jazz Greats/25 Jazz Greats Vol 1/.02_count_basie__lets_jump.mood" /mnt/extSdCard/Music
failed to copy '/home/bob/Music/jazz-collections/25 Jazz Greats/25 Jazz Greats Vol 1/.02_count_basie__lets_jump.mood' to '/mnt/extSdCard/Music/.02_count_basie__lets_jump.mood': Permission denied

Using main memory seems to work fine.

Also, can I copy entire directory trees, or just one file at a time?

Thanks!

broken symlink trouble

it is not uncommon to have a symlink that points to a nonexisting place (cache dir on /dev/shm that exist only when its app is running) and your current code cannot handle these
otherwise great idea using adb as file protocol instead of mtp !

Directory elimination

Hi, I just found the project some days ago and I love it since I hadn't any other reliable way for connecting my Samsung Galaxy S3 to my linux box. However I found that when you try to remove a directory, it just stay there (I tried with . prefixed directories) and I see in console: EXECUTE= adb shell rm /mnt/sdcard/.skynet, I think you missed the -r option there, so I go and search for execution instruction on files and found this (on src/Aafm.py):
self.execute('%s shell rm %s' % (self.adb, self.device_escape_path(path)))
and I replaced with:
self.execute('%s shell rm -r %s' % (self.adb, self.device_escape_path(path)))
and it works just fine but I can't find a way to commit the change to github (other than clone the repo) so I create this ticket for you to update your code

Thanks for your time and effort with this application

Escape paths

Using paths with parenthesis generates Syntax error: "(" unexpected in the device types of errors.

Must ensure paths are properly escaped before using them.

But what are the "forbidden" characters?

Remember the last directory

So we don't need to browse back to where we were the last time we launched the app

Could this be configurable? (would need a preferences-file sort of thing for that)

.desktop file

It'd be nice to have one. Not sure how it would work if this is packaged into a distribution.

Need root privilege to run this program!

Hello, @sole

I am using Arch Linux and have installed aafm from the package aafm-git in Arch User Repository.

It works good in the previous version.(20120414-4, which is built last year) However, after I updated the package aafm-git to the latest version 20140930-1, it needs root privilege to run this program. Otherwise, it outputs the following error message:

$ aafm

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 5, in <module>
    import gtk
  File "/usr/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 40, in <module>
    from gtk import _gtk
  File "/usr/lib/python3.4/site-packages/cairo/__init__.py", line 2
SyntaxError: Non-ASCII character '\xc2' in file /usr/lib/python3.4/site-packages/cairo/__init__.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

This makes aafm.desktop useless for ordinary users.

What's more, the package maintainer Cyber Way said :

I seldom use that desktop file.If it's not working, consider file an issue at the Github project page clearing describing the problem. It's better to fix issues in upstream project than in this PKGBUILD file.

So I decide to report this issue to you. Could you tell me how to run this program without root privilege? Or make the aafm.desktop execute the program with root privilege?

Hope for your reply!

Yours, sincerely

Add "Open" contextual menu entry

Add a new entry to the contextual menu to open currently selected file.

Locally it should open the file using the default associated program, remotely it should copy the selected file to a temporary directory and attempt to open it as before

symlinks don't show

symlinks have a 'l' as the permissions bit, and produce the "wasn't matched, please report to developer!" error message.

It would be nice if symlinks were shown in the window.

Do not show hidden files and folders

A typical home directory in a UNIX filesystem contains several "invisible" files and directories. Therefore the left pane in aafm becomes a pain when showing the home dir. I might be wrong, but I believe most people will not want to copy their .bashrc over to their tablet. Perhaps there should be a button to hide them or show them.

I suggest the default behavior of dir_scan_host should be

root, dirs, files = next(os.walk(directory))
files = [f for f in files if not f[0] == '.']
dirs = [d for d in dirs if not d[0] == '.']

Thanks for this awesome program!

Branch into nfs mountpoint not working

When I try to branch into the filesystem behind a nfs moutpoint I get the following error:

Traceback (most recent call last):
File "./aafm-gui.py", line 152, in host_navigate_callback
self.refresh_host_files()
File "./aafm-gui.py", line 170, in refresh_host_files
self.host_treeViewFile.load_data(self.dir_scan_host(self.host_cwd))
File "./aafm-gui.py", line 222, in dir_scan_host
'owner': self.get_owner(path),
File "./aafm-gui.py", line 271, in get_owner
user = pwd.getpwuid(uid)[0]
KeyError: 'getpwuid(): uid not found: 1026'

Jumping back via .. does not work either.

can not open folders on linux filesystem

I can open the gui and it 'mounts' my tab just fine, copying back and forth between my home directory and the tab works fine. I can not however navigate any deeper than my home/$user directory. If I try opening a folder, it simply doesn't work. This is the output I get when I try:

Traceback (most recent call last):
File "/usr/bin/aafm-gui", line 153, in host_navigate_callback
self.refresh_host_files()
File "/usr/bin/aafm-gui", line 171, in refresh_host_files
self.host_treeViewFile.load_data(self.dir_scan_host(self.host_cwd))
File "/usr/bin/aafm-gui", line 229, in dir_scan_host
size = os.path.getsize(path)
File "/usr/lib/python2.7/genericpath.py", line 49, in getsize
return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory: '/home/$user/Videos/Videos'

The folder I am trying to access is /home/$user/Videos. For some reason, it appends an extra '/Videos' to it which doesn't exist. If I create a /home/$user/Videos/Videos symlink that simply points to /home/$user/Videos I can open it though.

Can't Write to Device

I have same issue as #41 . When I try to copy any file from extSdCard on my rooted Samsung Galaxy S4, it fails with a "permission denied" error. The card is formatted exFAT and can be written to by the phone and by the PC when it is directly plugged into the PC. I'm running Ubuntu 10.04.

Inexistent gid causes crash

My home folder is used by many installed GNU/Linux distributions, so some files could be have inexistent gid.

$ ls -ld /home/common/Skype/
drwx------ 6 muflone 1000 4096 11 ago 00.49 /home/common/Skype/
$ getent group 1000

Such files cause aafm to crash:

$ aafm

** (process:28033): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'

** (process:28033): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'

** (process:28033): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
EXECUTE= adb shell ls --help
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 803, in <module>
    gui = Aafm_GUI()
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 141, in __init__
    self.refresh_host_files()
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 183, in refresh_host_files
    self.host_treeViewFile.load_data(self.dir_scan_host(self.host_cwd))
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 237, in dir_scan_host
    'group': self.get_group(path)
  File "/usr/lib/python2.7/site-packages/aafm/aafm-gui.py", line 297, in _get_group
    return grp.getgrgid(gid)[0]
KeyError: 'getgrgid(): gid not found: 1000'

Your app should gracefully handle unknown gid

Dir backtrace error

Keep clicking '..' on the left panel, i.e. keep walk into parent directory finally gives me this error:

Traceback (most recent call last):
File "/usr/bin/aafm-gui", line 153, in host_navigate_callback
self.refresh_host_files()
File "/usr/bin/aafm-gui", line 171, in refresh_host_files
self.host_treeViewFile.load_data(self.dir_scan_host(self.host_cwd))
File "/usr/bin/aafm-gui", line 229, in dir_scan_host
size = os.path.getsize(path)
File "/usr/lib/python2.7/genericpath.py", line 49, in getsize
return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory: '/tools'

Nowhere to set the initial path

Hi! Thx to ur great work on aafm. It impresses me a lot & remind me of the wonderful moment using Total Commander on Windows. ^_^ But could u pls make a configuration file such as .aafmrc for usrs setting the initial path rather than os.getcwd() and '/mnt/sdcard'? In my system(Arch Linux), it leads me to /home/usr/Documents which is not exist. I'm border to click .. every time. Sorry for my broken English, I'm just a newbie. -.-!

Hope ur program be yet another Total Commander bridging PC and Android!

Thanks and Regards,

If a symlink points to a subdirectory within the same directory, the parent cannot be opened

With the current images for the Firefox OS Flame, aafm cannot open the root directory of the device.

The issue comes down to this:

root@flame:/ # ls -l storage/
drwxrwxr-x root sdcard_rw 1970-01-01 01:00 sdcard
lrwxrwxrwx root root 1970-01-08 22:57 sdcard0 -> /storage/sdcard

So, as that symlink points into the same directory it is in, the call in https://github.com/sole/aafm/blob/master/src/Aafm.py#L134 creates an endless loop and the parent of /storage (i.e. /) cannot be opened in aafm at all.
I work around this by just locally changing that line to |is_directory = False| but that's obviously not the right fix. ;-)

uncaught error caused by dangling symbolic links in local directory

Start aafm-gui.py in a directory where there is a symbolic link pointing to a file or directory that no longer exists, and aafm-gui.py exits.

For example...

ls -l /home/foobar/plugins
lrwxrwxrwx 1 foobar foobar 40 2011-01-12 15:04 /home/foobar/plugins -> /usr/local/mozilla/firefox-3.6.x/plugins

ls -l /usr/local/mozilla/firefox-3.6.x/plugins
ls: cannot access /usr/local/mozilla/firefox-3.6.x/plugins: No such file or directory

/usr/local/aafm/src/aafm-gui.py
EXECUTE= adb shell ls --help
Traceback (most recent call last):
File "/usr/local/aafm/src/aafm-gui.py", line 808, in
gui = Aafm_GUI()
File "/usr/local/aafm/src/aafm-gui.py", line 141, in init
self.refresh_host_files()
File "/usr/local/aafm/src/aafm-gui.py", line 183, in refresh_host_files
self.host_treeViewFile.load_data(self.dir_scan_host(self.host_cwd))
File "/usr/local/aafm/src/aafm-gui.py", line 241, in dir_scan_host
size = os.path.getsize(path)
File "/usr/lib/python2.6/genericpath.py", line 49, in getsize
return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory: '/home/foobar/plugins'

Removing the dangling symbolic link worksaround the problem.

It would be nice if aafm would simply ignore such dangling symbolic links.

[ Yes, I used this situation to get around to cleaning up that directory, but still... ]

Needs configuration

It would be nice to have a configuration option for:

  • Default local directory
  • Default remote directory

I edited the source goto my desired dirs, but a config opt would be nice

thanks
ZyMOS

ps great program, i used to have to run sshd and sftp to xfer

ls: : No such file or directory wasn't matched

When I run aafm it opens in /mnt/sdcard which is empty. The only thing that shows up is ..
When I open that I get this:

EXECUTE= adb shell ls --help
BusyBox ls detected
EXECUTE= adb shell ls -l -A -e --color=never "/mnt/sdcard/"
EXECUTE= adb shell ls -l -A -e --color=never "/mnt/"
EXECUTE= adb shell ls -l -A -e --color=never "/"
EXECUTE= adb shell ls -l -A -e --color=never "/data"
ls: can't open '/data': Permission denied wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never "/system"
EXECUTE= adb shell ls -l -A -e --color=never "bin"
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never ""
ls: : No such file or directory wasn't matched, please report to the developer!
EXECUTE= adb shell ls -l -A -e --color=never "/mnt"
EXECUTE= adb shell ls -l -A -e --color=never "/"
EXECUTE= adb shell ls -l -A -e --color=never "/data"
^CTraceback (most recent call last):
  File "aafm-gui.py", line 179, in device_navigate_callback
    self.refresh_device_files()
  File "aafm-gui.py", line 188, in refresh_device_files
    self.device_treeViewFile.load_data(self.dir_scan_device(self.device_cwd))
  File "aafm-gui.py", line 310, in dir_scan_device
    entries = self.aafm.get_device_file_list()
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 55, in get_device_file_list
    return self.parse_device_list( self.device_list_files( self._path_join_function(self.device_cwd, '') ) )
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 103, in parse_device_list
    is_directory = self.is_device_file_a_directory(target)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 138, in is_device_file_a_directory
    entries = self.parse_device_list(lines)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 103, in parse_device_list
    is_directory = self.is_device_file_a_directory(target)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 138, in is_device_file_a_directory
    entries = self.parse_device_list(lines)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 103, in parse_device_list
    is_directory = self.is_device_file_a_directory(target)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 138, in is_device_file_a_directory
    entries = self.parse_device_list(lines)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 103, in parse_device_list
    is_directory = self.is_device_file_a_directory(target)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 137, in is_device_file_a_directory
    lines = self.device_list_files(parent_dir)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 69, in device_list_files
    lines = self.execute(command)
  File "/home/<username>/Desktop/aafm/src/Aafm.py", line 36, in execute
    line = process.readline()
KeyboardInterrupt

It will repeat until I kill it. I can run the adb shell fine. There are no problems moving around and listing files, so I know my device is connected properly.
By the way I am using an Archos G9 101 Turbo 250GB with android 4.0.3
I am using Ubuntu 11.04 x64 and I have python version 2.7.1 installed.

Can't see any files on the android device

On my PC I'm running Ubuntu 10.01 (lucid), kernel 2.6.32-43-generic-pae.

Android device: Toshiba tablet, model AT-300, Android version 4.0.3, kernel version 2.6.39.4-00013-g7d9fd87, build number IML74K.01.000041114.

When I start aafm, the right panel for the tablet is blank. Running the Android SDK tool ddms I am able to explore the file system on the tablet. In case it matters, this is the entry I have in the 51-android.rules file:

SUBSYSTEM==”usb”, ATTR{idVendor}==”0930”, ATTR{idProduct}==”0963”, MODE=”0666″

Can you tell me why I can't see any file on the tablet using aafm?

Thanks.

Can't see any files on the android device #2

Hi, I know you closed my original thread, this is what you wrote in the last comment:

Doesn't this ring a bell?

EXECUTE= adb shell ls --help
/bin/sh: adb: not found

If not, then maybe you didn't read and follow the instructions on the project page regarding setting adb in $PATH:
https://github.com/sole/aafm

But you closed the topic before I could respond. I DID read your instructions. They say this:

In case it doesn't work, you need to add the path to ADB to the environment PATH variable. In Linux this is done by editing a file called .bashrc in your home folder (.bash_profile in Mac OS). Locate a line that looks like PATH=$PATH and make it look like this:

PATH=$PATH:~/Applications/android-sdk-linux_86/platform-tools

Well, in my .bashrc there is no line with the PATH variable on it. The word PATH isn't in the file at all. So, being not very familiar with the Linux coding stuff, I wasn't sure what to do. I am not that familiar with this stuff, so I don't want to go changing files without someone knowledgeable telling me it is okay. I hesitated to just add this line to the bashrc file, because obviously on my system the PATH variable is being managed elsewhere - where? - and I don't know the ramifications of adding something like this to this file.

Are you able to tell me how to update this PATH variable so adb can run, or do you think I need to turn elsewhere for help?

Thanks.

ls parsing

I came across 2 problems with the parsing.

The first is that my device produces a slightly different format.

e.g. :

---xrwxr-x 1 system sdcard_r 0 Aug 4 01:50 cineworld.trace

I'm not sure if this is due to the rom (miui) or something else.

The second is that the format of the date depends on the age of the file. I think this is quite normal for ls. Relatively new files have no year but older files include a year.

I have replaced the parse_device_list as below. Obviously the date handling isn't really much of an improvement but accurate display of the date is a far second to displaying the files (for me anyway :)

def parse_device_list(self, lines):
    entries = {}
    pattern = re.compile(r"^(?P<permissions>[drwx\-]+) (?P<owner>\w+)\W+(?P<group>[\w_]+)\W*(?P<size>\d+)?\W+(?P<datetime>\d{4}-\d{2}-\d{2} \d{2}:\d{2}) (?P<name>.+)$")
    pattern = re.compile(r"^(?P<permissions>[drwx\-]+)\s+\d+\s+(?P<owner>\w+)\W+(?P<group>[\w_]+)\W*(?P<size>\d+)?\W+(?P<datetime>\w{3}[ :0-9]+) (?P<name>.+)$")

    for line in lines:
        line = line.rstrip()
        match = pattern.match(line)

        if match:
            permissions = match.group('permissions')
            owner = match.group('owner')
            group = match.group('group')
            fsize = match.group('size')
            if fsize is None:
                fsize = 0
            filename = match.group('name')

            try:
                timestamp = time.mktime((time.strptime("2011 " + match.group('datetime'), "%Y %b  %d %H:%M")))
            except:
                timestamp = 0

            is_directory = permissions.startswith('d')

            entries[filename] = { 
                'is_directory': is_directory,
                'size': fsize,
                'timestamp': timestamp,
                'permissions': permissions,
                'owner': owner,
                'group': group
            }

        else:
            print line, "wasn't matched, please report to the developer!"

    return entries

Copying a directory foo requires copying to foo/foo on computer.

I can't copy /sdcard/anything to /path/on/laptop/backup
I need to create /path/on/laptop/backup/anything
and then aafm will copy to /path/on/laptop/backup/anything/anything.

If I don't do this, I get this error:
COPY FROM DEVICE: /mnt/sdcard/.astro => /usr/local/lib/aafm/Android/GN_GSM_20120512/.astro
EXECUTE= adb shell ls -l -a "/mnt/sdcard"
/mnt/sdcard/.astro is a dir
Traceback (most recent call last):
File "./aafm-gui.py", line 581, in copy_from_device_task
self.aafm.copy_to_host(full_device_path, full_host_path)
File "/usr/local/lib/aafm/src/Aafm.py", line 198, in copy_to_host
os.mkdir(host_directory)
OSError: [Errno 2] No such file or directory: '/usr/local/lib/aafm/Android/GN_GSM_20120512/.astro/.astro'

Note that in the copy above, I was in /usr/local/lib/aafm/Android/GN_GSM_20120512/
It is aafm that mistakenly added '.astro' to the destination dir.

gvfs-gphoto2 conflict

On my RHEL6.2 machine if I unplug and replug the USB aafm no longer works and I get gvfs related USBDEVFS error messages similar to the below:
usb 1-1.2: usbfs: USBDEVFS_CONTROL failed cmd adb rqt 128 rq 6 len 256 ret -71

It looks to be some sort of conflict with gvfs-gphoto2 as I disabled the volume mounter by changing the pointer in /usr/share/dbus-1/services/org.gtk.Private.GPhoto2VolumeMonitor.service to a dummy entry and rebooted and it's now all working again.

Old /usr/share/dbus-1/services/org.gtk.Private.GPhoto2VolumeMonitor.service:
[D-BUS Service]
Name=org.gtk.Private.GPhoto2VolumeMonitor
Exec=/usr/libexec/gvfs-gphoto2-volume-monitor

New /usr/share/dbus-1/services/org.gtk.Private.GPhoto2VolumeMonitor.service:
[D-BUS Service]
Name=org.gtk.Private.GPhoto2VolumeMonitor
Exec=/usr/libexec/gvfs-gphoto2-volume-monitorx

Not sure if there's anything you can do but at least other users can learn from my tribulations.

Insufficient permissions for device

Hey,

at first let me say, keep up the good work! The tool is a real good idea!

My problem is, ADB gives me an error saying
"
EXECUTE= adb shell ls -la "/mnt/sdcard/"
error: insufficient permissions for device
"
after starting aafm-gui.py.

I've got a Galaxy Tab 10.1 with Android 3.1, Kernel 2.6.36.3 and Build HMJ37 P7500XWKG9. (If necessary) It's not rooted and Development mode is enabled.
lsusb says:
"
Bus 002 Device 008: ID 04e8:685e Samsung Electronics Co., Ltd
"

It'd be nice if you continue developing this nice tool and help poor non-windows-users like me ;-)

Best wishes,
Alex

EDIT
Additional information:
The tool also says:
"

  • daemon not running. starting it now on port 5037 * wasn't matched, please report to the developer!
  • daemon started successfully * wasn't matched, please report to the developer!
    "

I am using Ubuntu 11.04.

ls -la fails on my device

on my device (android 2.3.4 xperia ray) adb shell ls -la fails to execute as it interprets the 'a' as a file to list. It works great if "ls -la ..." is replaced with "ls -l -a ...".

Finer granularity for progress reporting

Finer granularity when reporting the progress of copy operations. Right now it's too coarse, and sometimes the window gets flagged as 'inactive' because it's not responding to the GTK loop (specially when copying huge files that take long or copying many files that take long too) (maybe use a queue...?)

Windows - Incorrect path separator

When run under windows the wrong file path separator is used for the device. This causes problems when displaying the root directory and copying files (probably other places too).

As an easy fix I added

command = str.replace( command , "" , "/" );

as the first line of the execute function in AAfm.py

multiple device support

"adb devices" gives a list of connected devices

serial number can be set in env['ANDROID_SERIAL]' or passed as "-s " on adb command line.

Windows - Unixisims (pwd/grp)

aafm-gui imports and uses pwd and grp. An appropriate Windows replacement seems to be

def get_owner(self, filename):
    #st = os.stat(filename)
    #uid = st.st_uid
    #user = pwd.getpwuid(uid)[0]
    #return user

    import win32api
    import win32con
    import win32security
    sd = win32security.GetFileSecurity( filename , win32security.OWNER_SECURITY_INFORMATION)
    owner_sid = sd.GetSecurityDescriptorOwner()
    name, domain, type = win32security.LookupAccountSid (None, owner_sid)
    return name

def get_group(self, filename):
    #st = os.stat(filename)
    #gid = st.st_gid
    #return grp.getgrgid(gid)[0]
    return ""

Make the window look more like a native file explorer window

It would be nice to be able to hide the local folder, and put the device_cwd into the title bar, to make the window more like a native file explorer window.

With a little more work, the progress bar could be moved into it's own window that would be opened for each operation.

Display operation progress in the main UI

First: the box that displays "Done", when transfer is complete needs to reset when a second transfer is performed.

Second: It would be nice for the main window to display the progress of operations, similar to what is displayed in stdout on terminal. but maybe less technical

can not mount sdcard

Using an xperia play 4.1.2 JB with ubuntu 12.04 Python 2.7.3. When I connect my phone and start the gui I get these outputs and no folders are visible on the phone's side of the gui.

EXECUTE= adb shell ls -l -a /mnt/
drwxrwxr-x 5 root system 0 Jan 6 18:39 . wasn't matched, please report to the developer!
drwxrwxr-x 16 system system 0 Jan 6 18:39 .. wasn't matched, please report to the developer!
drwxr-xr-x 7 root system 140 Jan 6 20:45 asec wasn't matched, please report to the developer!
drwxr-xr-x 2 root system 40 Jan 6 18:39 obb wasn't matched, please report to the developer!
lrwxrwxrwx 1 root root 16 Jan 6 18:39 sdcard -> /storage/sdcard0 wasn't matched, please report to the developer!
drwx------ 4 root root 0 Jan 6 18:39 secure wasn't matched, please report to the developer!

I believe the mount point for my device has changed since JB and is now /storage/sdcard0 and adb may have issues with that as well as this app.

Dragging file from host to device to copy doesn't work

OS: Arch Linux, Python 3
Device: Samsung Galaxy Tab

No error messages, no nothing-only frozen transfer progress bar.
Program doesn't hang; copy succeeds if right clicking over item and selecting 'copy to device'.

Someone else reported this somewhere else. I'm adding it here myself to keep track of this bug! Else I'll forget about it :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.