NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Accessing Android phone's files through MTP
Recently I was able to access the device with Android Debug Bridge (ADB)
and mount device storage on NetBSD:
<https://mail-index.netbsd.org/netbsd-users/2025/04/10/msg032539.html>
So I wanted to access files through MTP.
wip/jmtpfs failed (details at the end). So I thought I'd write the
process I followed to access files through MTP. Please let me know if
there are better ways to do this.
Here's how I built gmtp from source:
$ doas pkgin in libmtp libid3tag flac #dependencies
#>> download release from: <https://gmtp.sourceforge.io/downloads.html>
$ tar -xvf ~/Downloads/gmtp-1.3.11.tar.gz
$ cd gmtp-1.3.11
#>> -fcommon is for "multiple definition of" errors
#>> https://stackoverflow.com/a/73103447
$ ./configure CFLAGS=-fcommon
$ gmake
$ doas gmake install
To run:
#>> This is for an error
$ doas mkdir -p /usr/pkg/share/gvfs/remote-volume-monitors
#>> Env var is for a GLib-GIO-ERROR error
$ GSETTINGS_SCHEMA_DIR=/usr/local/share/glib-2.0/schemas gmtp
Usage:
With your device connected in MTP mode, click "Connect" from toolbar.
You might have to wait for some time.
It might show you whether you want to see files from "Phone storage" or
"SD card". Select one, click OK and it might again take some time to
show files.
To download a file from device, select a file, click Download.
To copy a file to device click "Add" from toolbar.
After done, click "Disconnect".
Here's jmtpfs failing in case anybody's interested:
$ doas mkdir -p /media/user/mtp
$ doas chown user:users /media/user/mtp
$ jmtpfs -o allow_other /media/user/mtp
Device 0 (VID=0bb4 and PID=0c02) is a HTC Android Device ID1 (Zopo, HD2,
Bird...).
PTP_ERROR_IO: failed to open session, trying again after resetting USB
interface
LIBMTP libusb: Attempt to reset device
LIBMTP PANIC: failed to open session on second attempt
terminate called after throwing an instance of 'MtpErrorCantOpenDevice'
what(): Can't open device
Abort trap (core dumped)
Backtrace:
$ gdb -ex "set pagination off" -ex "bt" -ex "quit" `which jmtpfs`
jmtpfs.core
GNU gdb (GDB) 11.0.50.20200914-git
...
[New process 24568]
Core was generated by `jmtpfs'.
Program terminated with signal SIGABRT, Aborted.
#0 0x0000789c0037eeea in _lwp_kill () from /usr/lib/libc.so.12
#0 0x0000789c0037eeea in _lwp_kill () from /usr/lib/libc.so.12
#1 0x0000789c003846e0 in abort () from /usr/lib/libc.so.12
#2 0x0000789c014fd165 in __gnu_cxx::__verbose_terminate_handler()
[clone .cold] () from /usr/lib/libstdc++.so.9
#3 0x0000789c014f2e2d in __cxxabiv1::__terminate(void (*)()) () from
/usr/lib/libstdc++.so.9
#4 0x0000789c014f2e6f in std::terminate() () from
/usr/lib/libstdc++.so.9
#5 0x0000789c014f2dd0 in __cxa_throw () from /usr/lib/libstdc++.so.9
#6 0x00000001c000d5c6 in ?? ()
#7 0x00000001c0007f90 in ?? ()
#8 0x00000001c0010270 in ?? ()
#9 0x00000001c00054cd in ?? ()
#10 0x00007f7eab40baf8 in ?? () from /usr/libexec/ld.elf_so
#11 0x0000000000000004 in ?? ()
#12 0x00007f7ffffeeaa0 in ?? ()
#13 0x00007f7ffffeeaa7 in ?? ()
#14 0x00007f7ffffeeaaa in ?? ()
#15 0x00007f7ffffeeab6 in ?? ()
#16 0x0000000000000000 in ?? ()
Home |
Main Index |
Thread Index |
Old Index