Coder Social home page Coder Social logo

whoozle / android-file-transfer-linux Goto Github PK

View Code? Open in Web Editor NEW
1.4K 36.0 118.0 3.43 MB

Android File Transfer for Linux (and macOS!)

Home Page: http://whoozle.github.io/android-file-transfer-linux/

License: GNU Lesser General Public License v2.1

C++ 87.50% C 5.41% CMake 6.10% Lex 0.17% Shell 0.09% Python 0.73%
mtp android lumia smartphone smartphone-interaction ui cli fuse linux file-transfer

android-file-transfer-linux's Introduction

Android File Transfer For Linux (FreeBSD and macOS, too!)

License Version Android File Transfer for Linux (and macOS!)

Android File Transfer for Linux — a reliable MTP client with minimalistic UI similar to Android File Transfer.

It just works™.

Do I need it?

If you're happy with gmtp/gvfs/mtpfs or any other MTP software, you might not need this software (but give it a try!).

If you're suffering from crashes, missing tags, album covers, USB freezes, and corrupted files however, this software is right for you.

Pre-built Packages

If your distribution does not provide an android-file-transfer-linux package, you can still install it on your system.

There's quite a few packages available:

Support me

If you want to help me with development, click on the link below and follow the instructions. I'm working on this project in my spare time and I try to fix everything as fast as possible, sometimes adding features in realtime (more than 100 tickets closed by now). Any amount would help relieving the pain of using MTP. :D

https://www.paypal.me/whoozle

Features

  • Simple Qt UI with progress dialogs.
  • FUSE wrapper (if you prefer mounting your device), supporting partial read/writes, allowing instant access to your files.
  • No file size limits.
  • Automatically renames album cover to make it visible from media player.
  • Supports Zune and Zune HD.
  • USB zerocopy support found in recent Linux kernels (no user/kernel data copying).
  • No extra dependencies (e.g. libptp or libmtp).
  • Available as a static/shared library.
  • Command line tool aft-mtp-cli.
  • Python bindings.

FAQ

Please take a look at the FAQ if you have issues with your operating system. It's not that big, but those are the questions asked very often.

Installation

Debian/Ubuntu

sudo apt-get install android-file-transfer

Gentoo

Android File Transfer for Linux is now included in Gentoo. You don't have to build anything, just run

sudo emerge -av sys-fs/android-file-transfer-linux

If you need a FUSE mount helper to mount MTP filesystems, you have to enable the FUSE use flag, e.g. adding the following in /etc/portage/package.use (which can either be a directory or a file):

sys-fs/android-file-transfer-linux fuse

You can use the sys-fs/android-file-transfer-linux-9999 ebuild if you want the latest Git version by adding the following entry to `/etc/portage/package.accept_keywords (which can either be a directory or a file):

=sys-fs/android-file-transfer-linux-9999 **

Arch

sudo pacman -S android-file-transfer

Building from source

Prerequisites

  • You will need the Qt libraries for building the UI program. If you're planning to use only the library (Qt is not needed), you could turn the option BUILD_QT_UI off.

  • For Ubuntu and other Debian-based distros, use the following command:

    sudo apt-get install build-essential cmake qt5-default ninja-build libfuse-dev libreadline-dev qttools5-dev

    For Fedora:

    dnf install make automake gcc gcc-c++ kernel-devel cmake fuse fuse-devel qt-devel readline-devel libqt5-linguist-devel
    
  • Basically

    • you need libqtX-dev or libqt5-dev for the UI,
    • libfuse-dev for the FUSE interface,
    • and cmake, ninja, or make for building the project.

Building with Ninja

mkdir build
cd build
cmake -G Ninja ..
ninja

./qt/android-file-transfer

Building with make

mkdir build
cd build
cmake ..
make

./qt/android-file-transfer

Installing binary package on macOS

There is a binary package that can be installed via Homebrew:

  • First, install brew if you don't have it already installed.
  • Then, the stable package may be installed via:
brew install homebrew/cask/whoozle-android-file-transfer
  • The nightly build may be installed via:
brew install homebrew/cask-versions/whoozle-android-file-transfer-nightly
  • Please note: Stable and nightly are in conflict, so please make sure to uninstall one of them when you want to switch between stable and nightly.

Building app package on macOS

You'll need Qt installed to build the GUI app. Here are the build instructions with Qt5 from Homebrew (brew install qt5):

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=~/Applications -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5
make
make install

open ~/Applications/android-file-transfer.app

Installation

sudo ninja install or sudo make install will install the program into the cmake prefix/bin directory (usually /usr/local/bin).

How to use

FUSE interface

mkdir ~/my-device
./aft-mtp-mount ~/my-device

Remember, if you want album art to be displayed, it must be named 'albumart.xxx' and placed first in the destination folder. Then copy other files. Also, note that FUSE could be 7-8 times slower than UI/CLI file transfer.

Qt user interface

  1. Start application, choose destination folder and click any button on toolbar.
  2. The options available are: Upload Album, Upload Directory, and Upload Files. The latter two are self-explanatory. Upload Album tries searching the source directory for album covers and sets the best available cover.
  3. You could drop any files or folders right into the application window: the transfer will start automatically.

Known problems

Up-to-date list of all known problems and bugs are available here.

Contacts

Please do not hesitate to contact me if you have any further questions. My email address is [email protected].

Special thanks

  • All who filed bugs on GitHub and wrote emails. Many features came to be only because of your feedback. Thanks!
  • Alexey gazay Gaziev for useful suggestions, support, and invaluable help with the MacBook and macOS port.
  • @ssnjrthegr8 for the new logo!

License

Android File Transfer for Linux is released under the GNU LGPLv2.1 License.

Copyright © 2015-2022 Vladimir Menshakov

android-file-transfer-linux's People

Contributors

alphashadows77 avatar ammgws avatar avolkov-astra avatar bearsh avatar begasus avatar chiuley avatar city-busz avatar d1vanov avatar danyspin97 avatar dschmidt avatar gazay avatar huupoke12 avatar ilya87 avatar janh avatar jbeich avatar johannes87 avatar katarn avatar mb720 avatar pfiver avatar probonopd avatar pulkomandy avatar rhenium avatar thesamesam avatar vascom avatar vistaus avatar wandmalfarbe avatar wataash avatar whoozle avatar ysaxon avatar yurikoles 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-file-transfer-linux's Issues

Sort file list

In version 2.0, the file list is unsorted. It would be nice if files and directories were displayed in standard alphabetical order, with folders first.

tar.gz files can't be uploaded

If I'm trying to upload some tar.gz/tar.bz2 archive it's not accepted by application:

uploadFiles  ("/home/civil/Music/music.tar.gz")
usbfs limit:  2048 Mib
uploading file  "/home/civil/Music/music.tar.gz"
unknown format for  "music.tar.gz"
progress size 1159775167
finished

And it actually looks like "successful upload", but in fact file wasn't upload and no error message was shown.

Expected behavior - upload anything, even unknown formats, because it's up to user to decide what to upload and why.

Provide icon and desktop file

The application should have an icon and a .desktop file to properly integrate with Linux desktops.

Here is an example .desktop file (to be placed in /usr/share/applications/android-file-transfer.desktop)

[Desktop Entry]
Name=Android File Transfer
Comment=Transfer files to and from MTP devices
Exec=android-file-transfer
Icon=android-file-transfer
StartupNotify=false
Terminal=false
Type=Application
Categories=Utility;FileTools;Filesystem;Qt;

Падает при старте

Arch Linux 3.19.2, никакие MTP девайсы не подключены.

% ./qt/android-file-transfer
upload worker started 
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/004/002: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/004/001: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/003/002: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/003/001: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/003: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/002: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/001: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/005: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/003: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/004: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/002: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/007: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/006: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/001: Отказано в доступе
libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes.
device was not found
Аварийный останов (core dumped)

Add more shortcuts for directory navigation

Currently only "Esc" is supported for going up one level. It would be batter to add more familiar "BkSp" and "Alt-up arrow".

Also it would be more convenient to allow to use numpad "Enter" to go into a directory (in addition to main block "Enter").

FUSE does not write files to samsung devices

$ cp test.txt ~/mtp/SECZ9519043CHOHB/Documents/test.txt
cp: невозможно создать обычный файл «/home/repsac/mtp/SECZ9519043CHOHB/Documents/test.txt»: Ошибка ввода/вывода
$ ls ~/mtp/SECZ9519043CHOHB/Documents/
итого 0
-rw-r--r-- 1 root root 0 янв 1 1970 test.txt

Пробовал и так и сяк, и на разные storage создается файл 0 длины и всё.

Uploading to tab's card doesn't work.

I am using Samsung Galaxy Tab Pro SM-T525. Uploading files to the tab's internal storage works fine. Uploading the same files to the tab's removable flash card doesn't work. I keep getting errors like

uploading file "/home/user/books/Spoor/Spoor2.htm" failed: Get: invalid response code GeneralError (0x2002)

Deleting files may cause segmentation fault

I cannot reproduce this bug reliably, but occasionally deleting all files in a directory results in segmentation fault. The console output looks like this (there were 3 files):

remove rows 1 1
remove rows 0 1
remove rows 2 1
Segmentation fault

The last file is not deleted. Deleting it fron the second try works.

Progress bar displays wrong values

When I upload to a tab large volume at once (over 1.2G), the progress bar seems to reach 100% at about 1100-1200 M regardless of actual volume, be it 1.5G or 5G.

Mark the last visited directory

When a user traverses the directory tree and goes up one level (e.g. by pressing Esc), nothing indicates where did he come from. It would be more convenient, if the marker was placed on the last visited directory.

Incomprehencible error from using GUI after FUSE

Observed for ru_RU.UTF8 locale. When I mount the device with aft-mtp-mount and then try to launch android-file-transfer, a messagebox appears with something like:

ioctl(_fd, USBDEVFS_CLAIMINTERFACE, &interfaceNumber): Đ£ÑœÑŸÑ€Đ¾Đ¹ÑœÑŸĐ¹Đ¾ ...

The message seems to have been converted from ISO-8859-1 to UTF-8, like in issue #34. This bug is observed in a version where #34 has already been fixed.

QtCreator compilation problems

Hi,
I'm trying to build the project via QtCreator and faced with few problems which I would like to discuss here. Let's move step by step.

I'm opening qt/qt.pro
and trying to build it. Getting:

../../android-file-transfer-linux/mtp/usb/BulkPipe.h:22:24: fatal error: usb/Device.h: No such file or directory
 #include <usb/Device.h>

Same for #include <usb/Interface.h>
There are 3 Device.h and 2 Interface.h in project. Which one shall be linked? If it depends than could you add some switch to qt.pro for these build modes?

CLI/FUSE tools

Your library is currently more stable/sane than most of other libraries (at least it works better than other libraries). Maybe it'll be good idea to make fuse interface or at least some CLI stuff, cause current GUI is really looks like "proof of concept" stuff, not as something usable.

Clipboard support

Investigate and implement copying/pasting files from/to clipboard

FIle downloading issue

I've tried to download previously uploaded photo and got it back broken. The console:

downloading to  "/home/truf/Изображения" 
downloading  14 to "/home/truf/Изображения/marceline_final_lr_by_artgerm-d7pvus5.jpg" 
progress size 398504 
finished 

The reported file size is correct. Files could be downloaded here. It's clear that broken file has some byte ordering issues at the end.

ioctl(_fd, USBDEVFS_CLAIMINTERFACE, &interfaceNumber): Device or resource busy

android-file-transfer displays the below message on start:

ioctl(_fd, USBDEVFS_CLAIMINTERFACE, &interfaceNumber): Device or resource busy

And then the program exits.

P.S. sudo ./android-file-transfer displays the same error message

P.P.S. At the same time, adb push works fine even under non-root user:
xx@xxx ~/Downloads/android-file-transfer-linux-2.2/build/qt $ adb push ./android-file-transfer /storage/sdcard1
4532 KB/s (531148 bytes in 0.114s)
xxx@xxx ~/Downloads/android-file-transfer-linux-2.2/build/qt $

P.P.P.S. OS=Linux Mint 17.1 64-bit

Replacing existing file UX

Regarding file uploading I would like to note that if you try to upload a file which already exist on device you'll get no warnings in GUI and this in console output:

uploading file  "/home/truf/Изображения/wallp/marceline_final_lr_by_artgerm-d7pvus5.jpg"
  failed:  SendObjectInfo: invalid response code InvalidParameter (0x201d) 
progress size 398504 
finished 

Would be great if GUI user will be informed.

[WP] Can't delete a file

I'm getting Get: Invalid response code InvalidParameter (0x201d) any time I'm trying to delete a file on WP device. Console:

./qt/android-file-transfer 
upload worker started
device info "NOKIA"   "909"
device found, opening session...
session opened, starting
remove rows  4   1

File isn't removed neither from device disk nor from GUI.
wireshark trace: http://1drv.ms/1d8dswD
(Only file deletion attempt is captured)

aft-mtp-cli should have nicer UI

Now it looks too low-level:

$ ./aft-mtp-cli list

Canon Inc. Canon PowerShot SX160 IS 1-13.0.1.0 B65F3B9BC7414886A6FA40044A7D5D80
supported op codes: 1014 1015 1016 1017 1001 1002 1003 9013 905c 905d 9999 901f 1004 1005 1006 1007 1008 1009 100a 101b 100c 100d 100b 100f 1012 9001 9021 901b 901e 9019 9006 901c 9002 904c 9024 9025 9038 9039 903a 903b 904b 9060 9062 900e 900f 9010 9011 9801 9802 9803 9804 9805 9050 9051 
supported properties: d045 d04a d02e d02f 5001 d002 d003 d034 d047 d046 d030 d049 d032 d033 d031 d050 d051 d052 d402 d406 d407 d303 
524288     3001 DCIM 0 0x0, 
262144000  3001 MISC 0 0x0, 
262171     bf01 PS.FI2 155664 0x0, 

$ ./aft-mtp-cli list 524288
Canon Inc. Canon ...
...
26214400   3001 100CANON 0 0x0, 
29622272   3001 113___04 0 0x0, 

$ ./aft-mtp-cli list 29622272
...
29654085   b105 MVI_1988.MOV 215596544 1280x720, 20150402T003839.0
29654101   b105 MVI_1989.MOV 637654732 1280x720, 20150402T004005.0

$ ./aft-mtp-cli get 29654101
...
object id = 29654101
filename = MVI_1989.MOV
^C

I should be more like ftp program:

$ ./aft-mtp-cli
Canon Inc. Canon PowerShot SX160 IS 1-13.0.1.0 B65F3B9BC7414886A6FA40044A7D5D80
supported op codes: 1014 1015 1016 1017 1001 1002 1003 9013 905c 905d 9999 901f 1004 1005 1006 1007 1008 1009 100a 101b 100c 100d 100b 100f 1012 9001 9021 901b 901e 9019 9006 901c 9002 904c 9024 9025 9038 9039 903a 903b 904b 9060 9062 900e 900f 9010 9011 9801 9802 9803 9804 9805 9050 9051 
supported properties: d045 d04a d02e d02f 5001 d002 d003 d034 d047 d046 d030 d049 d032 d033 d031 d050 d051 d052 d402 d406 d407 d303
> help
ls - list current or specified directory
ls_raw - verbose list
get - download file to current directory
get_raw - download file by number instead of by name
cd - change current directory
cd_raw - change current directory by number instead of by name
> ls
DCIM
MISC
PS.FI2
> ls_raw
524288     3001 DCIM 0 0x0, 
262144000  3001 MISC 0 0x0, 
262171     bf01 PS.FI2 155664 0x0, 
> cd DCIM
> list
100CANON
113___04
> cd 113___04
> list
MVI_1988.MOV
MVI_1989.MOV
> get MVI_1989.MOV
filename = MVI_1989.MOV
^C

$ ./aft-mtp-cli get DCIM/113___04/MVI_1989.MOV
Canon Inc. Canon ........ d407 d303
object id = 29654101
filename = MVI_1989.MOV
^C

I don't like switching myself from command line mode to GUI mode, so command-line android-file-transfer would be useful for me, as aft-mtp-mount fails to work with this camera.

gplv3?

Is there any particular reason why older version was chosen?

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.