Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Connection via USB between Debian and Android smartphone

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
de_se_77
Posts: 11
Joined: 2017-11-25 15:48

Connection via USB between Debian and Android smartphone

#1 Post by de_se_77 »

Hi,

I think should be a very simple operation i.e. connecting my smartphone via usb cable with PC running Debian, but it seems it is not. Simply in order to transfer general files such pdf documents or any exstension files.
I tried KDE connect: the devices simply don't see each other.
Then in some forums someone suggested to pay attention to the firewall. I did not install any firewall so I wonder if there is one default installed: it seems to be, but the default setting foresees all ports open.

I would like to transfer general files (not only .jpg or images that are managed by Gnview(?) or something like that).

Anyone can suggest me the proper tool to succeed in doing this?

I also tried ftp tools but also in this case no possibility to see the devices.

Thanks in advance

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

Re: Connection via USB between Debian and Android smartphone

#2 Post by L_V »

In KDE, you simply need kio-mtp & libmtp9.
Normally, udev should detect your smartphone. if correctly configured to MTP protocol (and not usb).

libmtp9: Media Transfer Protocol (MTP) library

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Connection via USB between Debian and Android smartphone

#3 Post by debiman »

^ well technically they do connect via USB, but then use the mtp protocol (instead of some filesystem).
de_se_77 wrote:the devices simply don't see each other.
this would suggest a more primitive problem, like a broken cable etc.

does the phone start to charge when you plug it in? does it show any sort of icon that indicates a connection?

you can verify your satement by entering

Code: Select all

dmesg -w
then plug in your device.
if you see new output, it means debian 'sees' the device.
if you're unsure, you can post the output here.

User avatar
makh
Posts: 651
Joined: 2011-10-09 09:16

Re: Connection via USB between Debian and Android smartphone

#4 Post by makh »

Hi

I assume you need to install:

Code: Select all

mtp-tools
along with the applications mentioned by: L_V

Then either those applications or the default file manager of KDE can auto detect. It seems you are using KDE.
ThinkPad E14: Arch, Debian Stable
GUI: Xfce

For new: Try MX Linux, Linux Mint; later join Debian Stable

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

Re: Connection via USB between Debian and Android smartphone

#5 Post by L_V »

makh wrote:I assume you need to install mtp-tools
No / not for KDE.
The key poiints are:
1 - to be detected, the smartphone should not be configured to "charge only", but to MTP (or file transfer / depending on the UI)
2 - the smartphone should be correctly detected by running:

Code: Select all

udevadm monitor --environment --udev
If not, a specific udev rule should be created ( in case of completely unknown brand).

de_se_77
Posts: 11
Joined: 2017-11-25 15:48

Re: Connection via USB between Debian and Android smartphone

#6 Post by de_se_77 »

L_V wrote:In KDE, you simply need kio-mtp & libmtp9.
Normally, udev should detect your smartphone. if correctly configured to MTP protocol (and not usb).

libmtp9: Media Transfer Protocol (MTP) library
Thank you for the suggestion L_V. I tried to install those libraries kio-mtp & libmtp9 (actually they were not present on the system) but the situation is the same as before.

The files browser sees the smartphone (main memory and SD one added, i.e. 2 memory devices) but when I try to paste some files on smartphone memories, the paste commend is in grey color i.e. the action is not allowed.

I forgot: still Kde connect (both smartphon and PC side) doesn't see anything. The files browser sees but cannot perform any paste action on phone.

de_se_77
Posts: 11
Joined: 2017-11-25 15:48

Re: Connection via USB between Debian and Android smartphone

#7 Post by de_se_77 »

makh wrote:Hi

I assume you need to install:

Code: Select all

mtp-tools
along with the applications mentioned by: L_V

Then either those applications or the default file manager of KDE can auto detect. It seems you are using KDE.
Ok thanks. If I understood well, this seems to be a NON KDE tool: anyway I tried but nothing changed.
I'm using KDE

de_se_77
Posts: 11
Joined: 2017-11-25 15:48

Re: Connection via USB between Debian and Android smartphone

#8 Post by de_se_77 »

debiman wrote:^ well technically they do connect via USB, but then use the mtp protocol (instead of some filesystem).
de_se_77 wrote:the devices simply don't see each other.
this would suggest a more primitive problem, like a broken cable etc.

does the phone start to charge when you plug it in? does it show any sort of icon that indicates a connection?

you can verify your satement by entering

Code: Select all

dmesg -w
then plug in your device.
if you see new output, it means debian 'sees' the device.
if you're unsure, you can post the output here.
Thanks debiman. I was not precise: as just replied to other users, the files browser can see the smartphone, but cannot perform any paste action on its memories. So I suppose there is a problem on the Android side and I have to find out what needs to be set on the phone in order to allow the paste action.

My phone is a Samsung Galaxy S2 Plus (GT-I9105P).
Last edited by de_se_77 on 2017-12-03 19:37, edited 1 time in total.

de_se_77
Posts: 11
Joined: 2017-11-25 15:48

Re: Connection via USB between Debian and Android smartphone

#9 Post by de_se_77 »

L_V wrote:
makh wrote:I assume you need to install mtp-tools
No / not for KDE.
The key poiints are:
1 - to be detected, the smartphone should not be configured to "charge only", but to MTP (or file transfer / depending on the UI)
2 - the smartphone should be correctly detected by running:

Code: Select all

udevadm monitor --environment --udev
If not, a specific udev rule should be created ( in case of completely unknown brand).
Thanks again L_V.
On Android side of the phone (Samsung Galaxy S2 Plus, GT-I9105P), I can select two options:
1. multimedia device ...
2. camera (PTP): it allows file transfer on PC of pictures and any other file type not supporting MTP

Tried both: the paste action on phone via PC browser is not allowed.

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

Re: Connection via USB between Debian and Android smartphone

#10 Post by L_V »

de_se_77 wrote:Tried both: the paste action on phone via PC browser is not allowed.
Can you at least read ?
If you cannot write, it's a right problem (likely sdcard protection).
Internal/external memories/sdcards do not have the same permissions.

de_se_77
Posts: 11
Joined: 2017-11-25 15:48

Re: Connection via USB between Debian and Android smartphone

#11 Post by de_se_77 »

L_V wrote:
de_se_77 wrote:Tried both: the paste action on phone via PC browser is not allowed.
Can you at least read ?
If you cannot write, it's a right problem (likely sdcard protection).
Internal/external memories/sdcards do not have the same permissions.
Yes, I' ve just tried: I can copy files from phone and past on PC.

Maybe there is a level protection that doesn't allow you to do normal and simple actions. I should try to become SU and see if something change. But I think it can only be done through line command.

Ok SOLVED.

I (tried) to change user becoming SU (root and password): the system told me I could not log in as root (why?) and so I logged with the normal user. Then I opened the shell becoming SU; then typed:

lsblk
lsusb

After that I pasted some files, using normal files browser, on phone memory without any problem.

I think the above commands were irrelevant (the experts can say that.. :-) and maybe what's important is logging in having the phone plugged on usb port: somehow the system recognize it from the beginning and let you do what you want.
Last edited by de_se_77 on 2017-12-04 21:59, edited 1 time in total.

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

Re: Connection via USB between Debian and Android smartphone

#12 Post by L_V »

It's the smartphone policy which can prevent the copy in MTP mode.
I use LineageOS and not android / cannot tell you more for your specific smartphone which is even not pure android.

de_se_77
Posts: 11
Joined: 2017-11-25 15:48

Re: Connection via USB between Debian and Android smartphone

#13 Post by de_se_77 »

L_V wrote:It's the smartphone policy which can prevent the copy in MTP mode.
I use LineageOS and not android / cannot tell you more for your specific smartphone which is even not pure android.
Thanks ones more L_V.
I'll try if can work for my phone: actually I was searching for something like that :-)

User avatar
michapma
Posts: 544
Joined: 2008-05-04 20:49
Location: Prague

Re: Connection via USB between Debian and Android smartphone

#14 Post by michapma »

de_se_77 wrote:I (tried) to change user becoming SU (root and password): the system told me I could not log in as root (why?)
Because it would be highly insecure to run an X session (session with graphical desktop environment) as root.

It sounds to me like you could get around this issue by temporarily enabling USB debugging before connecting to the machine.
https://www.kingoapp.com/root-tutorials ... ndroid.htm

Be sure to heed the warning:
USB Debugging should only be enabled when you need it. Leaving it enabled all the time is kind of a security risk for that this mode grants you high-level access to your device. Say if you connect your Android phone to a USB charging port in a public location, the port could use the USB access to your phone to access data on your phone or install malware. This could happen when and only when USB debugging mode is enabled.

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1388
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 45 times
Been thanked: 65 times

Re: Connection via USB between Debian and Android smartphone

#15 Post by None1975 »

For me, connection via usb between Debian (i use Debian 9.2+Ratpoison) and Android smartphone (i use Samsung Galaxy S7, Android version 7.0), works like a charm. After minimal installation via network installer, after installing xorg packages, i installed PCmanFM file manager. Apt installed all required dependencies. No additional configuration required.
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: Connection via USB between Debian and Android smartphone

#16 Post by bester69 »

To me is more comfortable and effective and definitly works better using the AirDroid web extension. I desintall Android apps from AirDroid interface, and move files in both directions.

Image
See--> https://s18.postimg.org/th1aczgvt/Escritorio_1_022.png

Ive been using it for some years, and Im very glad with Airdroid
https://www.airdroid.com/es-es/get.html
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

fmp
Posts: 40
Joined: 2017-09-09 04:01

Re: Connection via USB between Debian and Android smartphone

#17 Post by fmp »

I have never used pure android (I too, use LineageOS' version of Android) so this may not be the case for google's Android:

When you plug the usb into the computer, default mechanism is charging. It won't show up in the file manager on the computer while set to this..
If you swipe down to notifications, there should be a notification saying 'charging, click to change' or some similar verbiage to that.

If you click it, a pop up will appear with numerous options -> select MTP and you should now see the phone mounted in nautilus (if you're using gnome, for example)

Clicking on the phone name in the file manager will lead you to the android file system and SD card.

Post Reply