android driver for ubuntu 手机驱动

原文:http://esausilva.com/2010/05/13/setting-up-adbusb-drivers-for-android-devices-in-linux-ubuntu/

IfyouarelikemeandlikedevelopinginLinux,thenyouwillfindthisguideuseful.WhenIwassettingupeverythingformyAndroiddevelopment,IranintotheproblemthatLinuxwasnotrecognizingmyAndroidphone,andtookmesometimefiguringouthowtomakeLinuxrecognizemyphone.Finally,aftersomeresearchIwasabletoputthislittleguidetogetheranddecidedtoshareitwiththerestoftheworld.

ADB(AndroidDebugBridge)isahandytoolthatcomeswithAndroidSDKthatallowsyoutocontrolandinterfacewithyourAndroiddevice.

Update:02/04/11–HTCchangeditsVendorID,olderphoneshavedifferentIDthannewerphones.RefertoUSBVendorIDstableatthebottomofthistutorialtoseethechange.

Update:01/02/11–BymistakeIhadlinkedtheADBtoolforOSXinstep3.1.NowitshouldbethecorrectoneforLinux.

IMPORTANTUpdate12/11/10–TherehasbeenachangetothenewAndroidSDK.ADBToolhasbeenmovedto/android-sdk-linux_x86/plataform-tools,soifyouhavetheoldSDK,pleasedownloadthenewoneandupdateyourpath(Step9.2ofthistutorial).Ifthisisyourfirsttimedoingthis,thendisregardtheupdateandcontinuewiththetutorial.

Update:09/21/10–WorkingcodewithUbuntuLucidLynxandaddedmoreUSBvendorIDs.

1.DownloadthelatestAndroidSDKfromGoogle:AndroidSDK

2.ExtracttheTGZfiletoyourhome/YOUR-USERNAMEdirectory

3.TogetADB,youneedtoinstalltheSDK:InstallingtheSDK

*Ifyouarenotadeveloperandnotplanningtodevelop,thenjustdownloadthefollowingzipfilecontainingonlytheADBtoolandproceedwiththetutorial:ADB

4.Onyourphone,clickSettings>Applications>DevelopmentandmakesureUSBDebuggingison.

5.Loginasrootandcreatethisfile:/etc/udev/rules.d/##-android.rules

NOTE:Intheabovefilereplace##withthenumber50ifyouarerunningGusty/Hardy/Dapper(50-android.rules)orwiththenumber70ifyouarerunningKarmicKoala/LucidLynx/MaverickMeerkat(70-android.rules)

*Orsimplytypeinterminalsudogedit/etc/udev/rules.d/##-android.rulesthenenteryourpassword

6.Thefileshouldread:

*ForGusty/Hardy:SUBSYSTEM=="usb",SYSFS{idVendor}=="0bb",MODE="0666"

*ForDapper:SUBSYSTEM==”usb_device”,SYSFS{idVendor}==”0bb4″,MODE=”0666″

*ForKarmicKoala:SUBSYSTEM==”usb”,SYSFS{idVendor}==”0bb4″,MODE=”0666″

*ForLucidLynx:SUBSYSTEM==”usb”,SYSFS{idVendor}==”0bb4″,MODE=”0666″

*ForMaverickMeerkat:SUBSYSTEM=="usb",ATTR{idVendor}=="0bb4",MODE="0666"

NOTE:Intheabovelinesthecode”0bb4″referstoaHTCdevice.Ifyourphoneisfromadifferentmanufacturer,replacethecodewiththeappropriatefromthetablebelow.

NOTE:Ifyoucopyoneofthelinesmentionedabove,makesureyoureplacethequotationmarkswiththeonesinyourkeyboard,asthesehavedifferentdisplaycodeanditmightgiveyoua“nopermissions”error.

7.Execute:sudochmoda+rx/etc/udev/rules.d/70-android.rules

8.Reboot

9.TorunADByouneedtoaddanenvironmentvariabletoyourbashrcfile:

*Openaterminalwindowandtype:sudogedit.bashrc

*Addthefollowinglineattheend:exportPATH=${PATH}:/home/YOUR-USERNAME/android-sdk-linux_x86/platform-tools

*Saveandclose

10.Youshouldbereadytogo,typeadbdevicesinaterminalwindowwithyourphonepluggedin.

Ifyouseeaserialnumberpopupthatmeansyouaredone.Shouldlooksomethinglikethis:

Listofdevicesattached

HT99PHF02521device

11.Ifforsomereasonswhenrunningadbdevicesgivesyoua“nopermissions”error,trytypingthefollowinginterminal

*adbkill-server

*adbstart-server

USBVendorIDs

ManufacturerUSBVendorID

Acer0502

Dell413c

Foxconn0489

Garmin-Asus091E

HTC(OlderPhones)0bb4

HTC(Newerphones)18d1

Huawei12d1

Kyocera0482

LG1004

Motorola22b8

NexusOne/S18d1

Nvidia0955

Pantech10A9

Samsung04e8

Sharp04dd

SonyEricsson0fce

ZTE19D2

CommonADBCommands

-Listswhichdevicesarecurrentlyattachedtoyourcomputer

1.

adbdevices

-Dropsyouintoabasiclinuxcommandshellonyourphonewithnoparameters,orletsyouruncommandsdirectly

1.

adbshell

-LetsyouinstallanAndroidapplicationonyourphone

1.

adbinstall

-Remountsyoursysteminwritemode–thisletsyoualtersystemfilesonyourphoneusingADB

1.

adbremount

-Retsyouuploadfilestoyourphonesfilesystem

1.

adbpush

-Letsyoudownloadfilesoffyourphonesfilesystem

1.

adbpull

-Startsdumpingdebugginginformationfromyourhandsettotheconsole–usefulfordebuggingyourapps

1.

adblogcat

Now,asforthecredits,ItookTheUnlockr“HowTo”forWindowsasabaseforthisguide.

Ifyoulikedthistutorial,pleaseretweetand/orshare

注:rules文件中的双引号需手动改。

我的是motorolaID是22b8

相关推荐