Solved Problem with ADB - Android Debugging Bridge

I used to do a lot of adb pull and adb push to transfer file between my PC and my Android. After migrating to FreeBSD, I've a problem with ADB tool. I can do adb start-server and I can see my device in adb devices. But when I try to push a file to my Android, I receive some errors and the Android is disconnected. I mean it is not in the list of adb devices anymore.

Here is the error message.

Code:
% adb push vv.jpg /sdcard/
adb: error: failed to copy 'vv.jpg' to '/sdcard/vv.jpg': couldn't read from device
vv.jpg: 0 files pushed, 0 skipped. 23.5 MB/s (219001 bytes in 0.009s)

I can do adb shell . And adb pull seems to work. But I'm not sure about the consistency of it.

I'm using 13.0-RELEASE-p4 and I've tried with 2 usb cables and 2 android phones. [PS. They worked well on Linux.]
 
I've installed both and them and tried it. I don't know why but non of them works. Here is the terminal output.
I don't use smartphone anymore, but IIRC I was using GUI version of the port [as a root? I think!]. BTW it was a locked Samsung phone -- Android 6.x [EDITED]

Also check the transfer cable too. Bad cable could cause problem.
Finally, I had some random DC with transfering large files. Therefore, keep that in mind.
 
IIRC, the phone needs to be unlocked before you can do adb pull. XDA forums would be a good place to do some research on how to do that.

Also - has OP tried to install the Android tools as ports, rather than packages? Compiling has its benefits. Generally speaking, FreeBSD's support for Android development is rather limited - I tried exploring that topic a few years ago. Maybe the situation did improve since then.
 
I don't use smartphone anymore, but IIRC I was using GUI version of the port [as a root? I think!].
I'm using binary package and it didn't even open. Since the package name is sysutils/android-file-transfer-qt5, do I need to install some qt5 stuffs? Sorry, I'm a newbie. May be I should try port version too.
BTW it was a locked Samsung phone -- Android 6.x [EDITED]
Also check the transfer cable too. Bad cable could cause problem.
Finally, I had some random DC with transfering large files. Therefore, keep that in mind.
I think bootloader lock/unlock and root/unroot status of the Android shouldn't be a problem. As I mentioned in the post, I have tried with two cables and two different phones (different versions), and they also works well on Linux. So the cables shouldn't be problem too.

IIRC, the phone needs to be unlocked before you can do adb pull. XDA forums would be a good place to do some research on how to do that.

Also - has OP tried to install the Android tools as ports, rather than packages? Compiling has its benefits. Generally speaking, FreeBSD's support for Android development is rather limited - I tried exploring that topic a few years ago. Maybe the situation did improve since then.

AFAIK, adb pull and adb push are something like simply file transferring operations. So, as long as you are not dealing with Android's root, doing push and pull from /sdcard/ should be fine. I tinkle Androids a lot (not a dev though) and doing these tasks successfully in lock/unlock and root/unroot Androids.

I'm using the package version of android-tools-adb-29.0.6_1 and the port has the same version. If I'm gonna use the ports with default configs, isn't it the same as using packages?
 
I'm using the package version of android-tools-adb-29.0.6_1 and the port has the same version. If I'm gonna use the ports with default configs, isn't it the same as using packages?
Yeah, if you don't change any makefile knobs presented by make config, then it doesn't matter if you use ports or packages.
 
... transfer file between my PC and my Android.
Try sysutils/fusefs-jmtpfs. The Android phones file system is mounted like a ordinary hard disk, making it accessible to all kind of file transfer utilities, cp(1), net/rsync, sysutils/cpdup, to name a few, or find utilities, inclusive easy access from any file manager (drag and drop, rename, reorganize files, etc.). Documentation for usage: /usr/local/share/doc/jmtpfs/README.rst

As an alternative to wired android file transfer or syncronizer tools: net/syncthing (needs app installed on phone). It can wireless synchronize directories between phone and FreeBSD. I'm using both suggested utilities.
 
Try sysutils/fusefs-jmtpfs. The Android phones file system is mounted like a ordinary hard disk, making it accessible to all kind of file transfer utilities, cp(1), net/rsync, sysutils/cpdup, to name a few, or find utilities, inclusive easy access from any file manager (drag and drop, rename, reorganize files, etc.). Documentation for usage: /usr/local/share/doc/jmtpfs/README.rst

As an alternative to wired android file transfer or syncronizer tools: net/syncthing (needs app installed on phone). It can wireless synchronize directories between phone and FreeBSD. I'm using both suggested utilities.
If FreeBSD has Samba shares, an Android phone can easily pick that up over wifi. I think Android also supports NFS service, so FreeBSD can pick that up, too, just install the app (although I think the phone will need to be rooted). :P
 
Try sysutils/fusefs-jmtpfs. The Android phones file system is mounted like a ordinary hard disk, making it accessible to all kind of file transfer utilities, cp(1), net/rsync, sysutils/cpdup, to name a few, or find utilities, inclusive easy access from any file manager (drag and drop, rename, reorganize files, etc.). Documentation for usage: /usr/local/share/doc/jmtpfs/README.rst
Thanks for the detailed answer. I've tried it and it works. But only as root user.
Code:
% jmtpfs mtp                                                                 ~
No mtp devices found.
[255] % su                                                                   ~
Password:
 # jmtpfs mtp
Device 0 (VID=2717 and PID=ff40) is a Xiaomi Mi-2s (id2) (MTP).
Android device detected, assigning default bug flags
 # ls mtp/
Internal storage
 # fusermount -u mtp
fusermount: Command not found.
 # umount mtp
 # ls mtp/
 #

How can I do that without being the root user? I've already set vfs.usermount=1 in /etc/sysctl.conf if that is the case.

And the documentation says fusermount -u mtp but only umount mtp works.
 
it works. But only as root user.
...
How can I do that without being the root user? I've already set vfs.usermount=1 in /etc/sysctl.conf if that is the case.
Every time I use sysutils/fusefs-jmtpfs I su(1) root to execute the binary, didn't bother set up user access permissions. But it's easily done.

The Android phone is connected as a USB device, a device node /dev/usb/x.y.z and its symlink /dev/ugenx.y is created. To grant a user mount permission with jmtpfs that user needs read/write permissions to those node and symlink, and also to /dev/fuse.

To put this together:

- Add the user in the "operator" group:
Code:
# pw groupmod operator -m <user name>
- Make sure vfs.usermount is set to 1
- Create /etc/devfs.rules:
Code:
[system=5]
add path 'ugen*' mode 0660 group operator
add path 'usb/*' mode 0660 group operator
(/dev/fuse is already with a "operator" group and read/write mode bit created, no need to add.)

- Enable ruleset in /etc/rc.conf:
Code:
# sysrc devfs_system_ruleset=system
- Restart devfs(8):
Code:
# service devfs restart
- Make sure the mount point of the Android phone is owned by the user mounting

And the documentation says fusermount -u mtp but only umount mtp works.
The documentation was written with Linux in mind, fusermount comes with Linux not FreeBSD. To view which files are installed by package sysutils/fusefs-jmtpfs execute pkg info -l fusefs-jmtpfs.
 
I used to do a lot of adb pull and adb push to transfer file between my PC and my Android. After migrating to FreeBSD, I've a problem with ADB tool. I can do adb start-server and I can see my device in adb devices. But when I try to push a file to my Android, I receive some errors and the Android is disconnected. I mean it is not in the list of adb devices anymore.

Here is the error message.

Code:
% adb push vv.jpg /sdcard/
adb: error: failed to copy 'vv.jpg' to '/sdcard/vv.jpg': couldn't read from device
vv.jpg: 0 files pushed, 0 skipped. 23.5 MB/s (219001 bytes in 0.009s)

I can do adb shell . And adb pull seems to work. But I'm not sure about the consistency of it.

I'm using 13.0-RELEASE-p4 and I've tried with 2 usb cables and 2 android phones. [PS. They worked well on Linux.]
Apologies for hijacking this thread, but I have only just come across ADB and have no idea about how to get a shell set up on FreeBSD. What do I need to install? And is there a useful guide I should read/watch?
 
balanga This package is no longer available.
(DEPRECATED: Last release in 2016 and deprecated by upstream, please consider using devel/android-tools-adb instead
This port expired on: 2022-03-31)
 
Back
Top