Linux connect to android usb

How to connect Android 7.1 to Ubuntu Linux with USB?

I’m trying to connect a Google Pixel phone, with android 7.1, to a Ubuntu 16.04 laptop with a USB cable using mtp-tools. But the mtp doesn’t see the phone file system and gives the error message «Get Storage information failed». Then trying the mtp tools .

# mtp-detect libmtp version: 1.1.10 Listing raw device(s) Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics/Samsung) Nexus 4/5/7/10 (MTP). Found 1 device(s): Google Inc (for LG Electronics/Samsung): Nexus 4/5/7/10 (MTP) (18d1:4ee1) @ bus 2, dev 17 Attempting to connect device(s) Android device detected, assigning default bug flags Error 1: Get Storage information failed. ***** . USB low-level info: bcdUSB: 512 bDeviceClass: 0 bDeviceSubClass: 0 bDeviceProtocol: 0 idVendor: 18d1 idProduct: 4ee1 IN endpoint maxpacket: 512 bytes OUT endpoint maxpacket: 512 bytes . many lines omitted . # mtp-connect libmtp version: 1.1.10 Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics/Samsung) Nexus 4/5/7/10 (MTP). Android device detected, assigning default bug flags Usage: connect  Commands: --delete [filename] --sendfile [source] [destination] --sendtrack [source] [destination] --getfile [source] [destination] --newfolder [foldername] # mtp-filetree Device 0 (VID=18d1 and PID=4ee1) is a Google Inc (for LG Electronics/Samsung) Nexus 4/5/7/10 (MTP). Attempting to connect device(s) Android device detected, assigning default bug flags Error 1: Get Storage information failed. Device: (NULL) LIBMTP_Get_Storage(): Resource temporarily unavailable OK. 
cat /etc/udev/rules.d/51-android.rules SUBSYSTEM=="usb", ATTR=="18d1", ATTR=="4ee1", MODE="0666", OWNER="sullivan" 

Источник

Linux Commando

Initially a Linux command-line interface blog, it has evolved to cover increasingly more GUI app topics. Instead of just giving you information like some man page, I illustrate their usage in real-life scenarios.

Search This Blog

Tuesday, November 5, 2013

Connect Android and Linux using USB

I have a Samsung Galaxy Tab 2 tablet, running Android 4.1.1 (aka Jelly Bean). I’d like to transfer some files from the tablet to my Linux server running Debian 7.2 (aka Wheezy). The Android tablet connects via Wi-Fi to the same LAN as the Linux server.

There are many ways to transfer files between the 2 devices. For example, you could install an Android app named AirDroid which lets you manage your Android device from a desktop web browser, including file transfer. In this post, I’ll go another route, an arguably more direct and basic one. I’ll connect the 2 using a USB cable.

  1. Connect the 2 devices using a USB cable.
  2. With the Android device, navigate to the home page.
  3. Swipe down from the top of the page. You will see a message «Connected as a media device. Touch for other USB options»
  4. Tap on the message. The resulting screen specifies how you want the Android device to connect: as a Media device(MTP) or a Camera (PTP). While Linux has some support for MTP, I found it much easier to connect as PTP.
  5. Tap on the Camera (PTP) checkbox.
  6. Swipe down from home page again, and you will see that the tablet is mounted as a camera.
  7. Reset the USB device under Linux. The simplest way is to unplug the USB cable from both ends, and plug it back in.
  8. Make sure that the Android device is mounted on your Linux server. On my Linux GNOME 3 desktop, I clicked on the Computer icon, and the Android device was detected (GT-P3113). Click the device to mount it.
  9. Run your favourite file manager application on Linux, and proceed to transfer files.
Читайте также:  Signal and thread in linux

You can use the above method to transfer files if you happen to have (the right) USB cable around to connect the 2 devices. If cables is not your preference, you may want to look into the Android app Airdroid.

13 comments:

Anonymous said. Simple and fast. love it, thank you, Aah August 10, 2014 at 4:38 PM Eric Klopper said. Just saw your post now. Perfectly done. Between your solution and Airdroid I have everything I need for my Galaxy Note 3 / Debian integration.

Thanks from South Africa, Eric August 14, 2014 at 1:22 AM Anonymous said. Good job ! .
September 18, 2014 at 8:51 AM Anonymous said. Doesn’t work for .mp3 files. Might be the cable. December 9, 2014 at 7:36 AM Anonymous said. Connecting as a camera will only transfer image files. all other types are not visible. May 28, 2015 at 11:54 AM sarah said. Thanks for this blog very usefull information September 12, 2015 at 4:03 AM Unknown said. We can only transfer Image files. How to transfer videos and other files? Please help.. October 13, 2015 at 1:28 AM ben said. Have you also been able to view video from the android camera via usb?

I’ve found some projects. but no luck

https://github.com/bluezio/ipwebcam-gst
https://github.com/hyongbai/AndroidUsbCamera
https://github.com/yangh/uvcvideo August 27, 2016 at 7:37 AM Unknown said. All i have on the android phone is a charge flash November 3, 2019 at 3:50 PM crocodile_dondii said. This means your phone is set to the «USB for charging the phone» instead of PTP. You can get at this in settings/bt and device connection/usb.
The usb may not show until it’s actually connected by the cable.

Incidentally the cable must be a «charging and data transfer» type of cable. The newer ones ARE, but if you have an older phone, you’re going to need to find a cable that support data transfer. assuming your phone can do this, of course.

Читайте также:  Архивировать текущую папку linux

If you’ve had it connected to a Windows computer before, it will transfer data. January 9, 2020 at 4:13 PM Skitnevsky said. I just done this from start to finish. Worked a charm. Thank you. June 3, 2020 at 5:57 AM floogy said. MTP and mounting gives you access to all file types. September 4, 2021 at 12:39 PM Unknown said. Dear sir
When i press daim@tomy. /Desktop$ls
Daim.jpg(my picture) rony (dir).For copy my pic. to my mobile by usb cable. I press daim. $ cp Daim.jpg /run/user/1000/gvfs/mtp. /phone/picture but result is permisson denied ! what is solusion?mobile to desktop copy & move posible but not from desktop to mobile. October 2, 2021 at 1:21 PM

Источник

How to usb-connect android devices with adb under ubuntu [closed]

you probably run into the same problem like me. However, I found on the internet some more or less sub optimal solutions The basic idea is to start adb as root. The solutions I found were cumbersome. One proposal is to start adb per sudo. An other proposal was to set up a boot script in /etc/init.d My solution is to give adb the permission to start as root. To do so, switch to root

sudo bash chown root adb chmod ug+s-w adb 
sudo chown root adb sudo chmod ug+s-w adb 

Please do not do this! The authors of the adb program did not intend for its development machine side to be run as root, but rather to use a udev rule to allow access to listed device types only. Trusting a program more than its authors recommend is a bad idea! Also, voting to close as there’s not actually a question stated, while the topic has already been covered numerous times.

2 Answers 2

The Google recommended way to deal with ADB device permissions is to create an UDEV rule which would set appropriate permissions on device enumeration.

If you’re developing on Ubuntu Linux, you need to add a udev rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR property. For a list of vendor IDs, see USB Vendor IDs, below. To set up device detection on Ubuntu Linux: Log in as root and create this file: /etc/udev/rules.d/51-android.rules. Use this format to add each vendor to the file: SUBSYSTEM==»usb», ATTR==»0bb4″, MODE=»0666″, GROUP=»plugdev»

In this example, the vendor ID is for HTC. The MODE assignment specifies read/write permissions, and GROUP defines which Unix group owns the device node. Note: The rule syntax may vary slightly depending on your environment. Consult the udev documentation for your system as needed. For an overview of rule syntax, see this guide to writing udev rules. Now execute: chmod a+r /etc/udev/rules.d/51-android.rules When plugged in over USB, can verify that your device is connected by executing adb devices from your SDK platform-tools/ directory. If connected, you’ll see the device name listed as a «device.»

Источник

Читайте также:  Kaspersky endpoint security линукс

Connect Android To Arch Linux Via USB – Connect over MTP in Linux

Connect Android To Arch Linux Via USB

In this article, we’ll talk about how we can connect Android to ArchLinux via USB. When using Arch as a daily driver, you often might need transfer data between your phone and PC. However, like most other things, this is not enabled by default on Arch. In this module, we will learn how we do so using some very easy steps.

How to Connect Android To Arch Linux with a USB?

After a vanilla Arch installation you might notice that your File Manager doesn’t list your device even when it is connected to your PC via an USB.

No Phone Detected By File Manager

This is because we don’t have MTP support enabled. MTP ( Media Transfer Protocol ) is a protocol that lets you access Android File System. This protocol is not enabled by default on Arch.

Enable MTP Support with mtpfs

First enable MTP support by installing :

For devices running Android 4+, this should do the trick. However, on later versions, we would need another package called jmtpfs from AUR repository. You can fetch it by:

At this point, we have MTP enabled. However, it would still not be visible in your File Manager as it is not auto-mounted as we desire. To auto mount it, we need to install a package with :

Enable PTP Support

PTP stands for “Picture Transfer Protocol” and infact is the protocol on which MTP is based. When you communicate with your Android phone via PTP, it appears as a digital camera to your PC.

To enable PTP, we need to install a package with :

$ sudo pacman -Sy gvfs-gphoto2

Finally, for the changes to take effect, we need to reboot the system which can be done with :

Accessing Device Files

Once the system restarts, connect your Android Device via an USB to your PC and when the Device gives you a pop up, chose the desired option.

Now, your File Manager should list your device and you can access the Device files easily !

Accessing Device Files From Our File Manager

Conclusion

Note that this method works only for Android Phones only and won’t work with iPhones as it uses a different set of methods to connect to PCs. Hope you now know exactly how to connect Android to Arch Linux via USB over MTP/PTP for your file transfer. Stay tuned for further articles!

Источник

Оцените статью
Adblock
detector