ubuntu下设置Android手机驱动

如果下面的文章不好使,建议读一这个文章:http://forum.xda-developers.com/xperia-u/general/howto-usb-connection-to-ubuntu-t1574551

以下内容有时候会导致,有的时候手机无法识别,请读上面的文章。

默认情况下 Ubuntu系统无法识别android手机。

运行 adb devices 将会出现一堆 ???号

在这种情况下你可以按照如下方法解决

1.首先查看你手机的ID号

  在terminal下运行lsusb命令

  再将手机连接上电脑

  再次运行lsusb就会多出一个usb信息。该信息即为你手机的usb信息

  Bus 002 Device 007: ID 18d1:4e21  

  PS:红色字体为手机的ID号,同一款手机的ID号是一样的。本人手机为(NS)

2  .创建配置文件

sudo vim /etc/udev/rules.d/XXX.rules

XXX为你自定义的文件名

输入以下 内容

SUBSYSTEM=="usb", SYSFS{"idVendor"}=="18d1", MODE="0666"

在红色字体的部分 添加上 你 自己手机的id

    sudo chmod a+rx /etc/udev/rules.d/XXX.rules

    sudo /etc/init.d/udev restart

3.重启adb服务(必须为sudo 已配置android环境变量)

    sudo ./adb kill-server

    sudo ./adb devices

给梦想一点时间
---------------------------------------------------------------------
you want MTP support on Ubuntu, try this:
  1. Connect Xperia S to an USB2 port.
  2. Use the "lsusb" command to list your devices in a terminal
    One of the lines should look like this:
    Code:
    Bus 002 Device 012: ID 0fce:5169 Sony Ericsson Mobile Communications AB
  3. Note your vendor- and product id. Usually this is "0fce" for the vendor and "5169" for the product id. If you have USB debugging disabled, product id will be "0169".
  4. unplug your phone
  5. read this thread: humans-enabled.com
    Install the newest Version of "libmtp" and copy the 69-libmtp.rules file to /etc/udev/rules.d as described
  6. Edit: This step may not be necessary for you!
    Xperia S support is implementet in the libmtp-1.1.3. release. If you use the newest version from sourceforge.net
    skip this and go to step 7.


    type following to edit the copied file as root:
    Code:
    sudo gedit /etc/udev/rules.d/69-libmtp.rules
    Add the following text somewhere around the sony ericsson devices that are in this file. You can find them by searching for "0fce". Remember to set the correct vendor and product id:
    Code:
    # Sony Xperia S
    ATTR{idVendor}=="0fce", ATTR{idProduct}=="5169", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
    ATTR{idVendor}=="0fce", ATTR{idProduct}=="0169", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"
  7. reboot, or use
    Code:
    sudo udevadm control --reload-rules
    to actualise.
  8. Plug in your device to a USB2 port, it will mount automatically. Use nautlius to copy files around.
原文地址:https://www.cnblogs.com/0616--ataozhijia/p/3658649.html