Commit graph

110 commits

Author SHA1 Message Date
Dan Albert
c1cfbd304a Include the git sha in the adb version.
Also add --version to adbd to display the same thing.

Change-Id: I47dfbad16c892c42ea938aedd085ba77492791ba
(cherry picked from commit 1ba1d7c1ee)
2015-05-06 09:11:16 -07:00
Elliott Hughes
92af733ee2 More adb buffer fixes.
This patch factors out a lot of the basic protocol code: sending OKAY,
sending FAIL, and sending a length-prefixed string.

ADB_TRACE has been non-optional for a long time, so let's just remove
the #ifs.

Also actually build the device tracker test tool (and remove its duplicate).

Bug: http://b/20666660
Change-Id: I6c7d59f18707bdc62ca69dea45547617f9f31fc6
(cherry picked from commit e67f1f87d9)
2015-05-01 17:09:34 -07:00
Elliott Hughes
03a90d6633 Support the full length of USB serial numbers.
Two bugs: we couldn't report the serial number correctly if it was long
enough, and it wasn't possible to connect to a device whose serial number
was long enough to overflow a different fixed-length buffer.

Bug: http://b/20317730

(cherry picked from commit 9309ecbcec)

Change-Id: I04c160a215418a57bd4fb27b7f63060c8be6f12e
2015-04-27 17:19:01 -07:00
Elliott Hughes
e434ad1dd7 Merge "Always explain why bind(2) failed." 2015-04-21 16:52:21 +00:00
Colin Cross
dc1e482b20 Fix windows adb build
libc++ is not available on windows yet, but it already defaults to
static libstdc++.

Change-Id: I85a766ead84f71fe1f2f59be6ac739b0b833b6db
2015-04-20 12:43:02 -07:00
Colin Cross
b2b06de5fc Merge "statically link adb and fastboot against libc++" 2015-04-20 18:05:29 +00:00
Elliott Hughes
7b506090e1 Always explain why bind(2) failed.
This has confused several people lately.

Bug: http://b/20219978
Change-Id: I2537ceb83bff0b3166c230c728d4389a983db858
2015-04-20 08:09:20 -07:00
Elliott Hughes
53daee6a2b Fix the Windows adb build.
It looks like we can't use clang on Windows yet because libc++ isn't ready.
So move back to GCC for the Windows host clang. Work around the mingw
printf format string problems that made us want to switch to clang in the
first place, and #include "sysdeps.h" in adb_utils.cpp to work around the
absence of lstat(2) on Windows.

Change-Id: Icd0797a8c0c2d1d326bdd704ba6bcafcbaeb742f
2015-04-19 13:17:01 -07:00
Elliott Hughes
2083fa6b01 Switch adb over to clang.
Change-Id: Ib5511dcba56e80ffce6bc293d99251ccfd61c330
2015-04-17 15:27:13 -07:00
Elliott Hughes
5830577bd8 Fix more buffer overruns.
Also add some tests.

Bug: 20323050
Change-Id: I9eaf3dc04efd85206663c4cca4f8c1208620a89a
2015-04-17 15:23:31 -07:00
Elliott Hughes
2baae3a876 Remove various fixed-length buffers (and their overflows).
Bug: 20323052
Bug: 20323051
Bug: 20317728
Bug: 20317727
Bug: 20317726
Bug: 20317725
Change-Id: I57a5e30a5b7867715f55cee7429aa36d7ce21484
2015-04-17 10:59:34 -07:00
Dan Albert
a4802ca08b Merge "Move usb_osx to C++." 2015-04-17 04:37:47 +00:00
Dan Albert
c4f8fa7b36 Merge "Link libraries needed for Darwin adb tests." 2015-04-17 04:37:41 +00:00
Dan Albert
7447dd05bd Move usb_osx to C++.
Change-Id: I21673211a702cc4f31d4311c36e2a4b22e55fac8
2015-04-16 19:20:40 -07:00
Dan Albert
f8d6b9b1ef Link libraries needed for Darwin adb tests.
Change-Id: I1c3c3a7bbd3824f5f3a37ee80c24d1c2a9b98748
2015-04-16 19:13:58 -07:00
Colin Cross
55bf5f0017 statically link adb and fastboot against libc++
libc++.so is not widely available on the host, so we compile against
one built as part of the platform.  This causes problems for adb and
fastboot, which are distributed through a number of channels - the
sdk, distro packages, downloaded from the build server, or manually
copied.  Instead of forcing all users to handle libc++.so too,
statically link against libc++.

Change-Id: I51b75258653a23558c8b598802005f6c1166a439
2015-04-16 17:09:46 -07:00
Elliott Hughes
a2f2e56796 Move sysdeps_win32 to C++.
Change-Id: I27ca41b64d62bb3611b3a39a5c3bb4377d0773bc
2015-04-16 16:47:02 -07:00
Elliott Hughes
2acec9153e Switch usb_linux_client to C++.
Change-Id: I8172e81e6c4665aa16e9e8e0c33b048dbb9ad848
2015-04-16 14:38:37 -07:00
Elliott Hughes
1a4d85a5e8 Move get_my_path_darwin to C++.
As long as we have C in here, we can't use C++ in our headers.

Change-Id: Ibccaa77a5af506dc504aa9c39c8dca5dcdbeccab
2015-04-16 13:24:58 -07:00
Elliott Hughes
bcc2b5f44a Remove LOCAL_ADDITIONAL_DEPENDENCIES in cases where it's not needed.
Change-Id: I720b8ef1050da45a7833adef8219b6acb2cf3a38
2015-04-02 14:31:07 -07:00
Tao Bao
175b7bbfb4 adb: Add option to reboot into sideload mode in recovery
Currently it requires manual key press to enter the sideload mode. This
CL adds 'adb reboot sideload' to reboot the device into sideload mode
directly with text display on. With 'adb reboot sideload-auto-reboot',
it will reboot after the sideload regardless of the installation result,
unless interrupted by user.

Since it needs to write to /cache/recovery/command file, 'adb root' is
required before calling 'adb reboot sideload' and the one with
'-auto-reboot'.

Also it requires the matching CL in bootable/recovery.

Change-Id: Ib7bd4e216a1efc01e64460659c97c6005bbaec1b
2015-03-31 00:19:52 +00:00
Elliott Hughes
ec7a667131 Revert "Revert "adb: support /oem partition""
This reverts commit 6084a0124f.

The original build breakage is fixed by (a) building the verity
code for eng builds as well as userdebug builds and (b) moving
the exported remount service functions into a new header file.

Change-Id: Ice0c4f97d4db38ab7eb333c7a6e56bbd11123f5b
2015-03-16 20:05:21 -07:00
Dan Albert
c007bc3856 Revert "Revert "Create libbase.""
This reverts commit a7870d8816.
2015-03-16 10:08:46 -07:00
Nicolas Geoffray
a7870d8816 Revert "Create libbase."
Breaks internal master.

This reverts commit 98ff77204c.

Change-Id: I18dc6021cb43efff8aa88486c2d980dc2b8eedba
2015-03-16 11:07:29 +00:00
Dan Albert
98ff77204c Create libbase.
Move StringPrintf and the string based file I/O from libutils to
libbase.

Change-Id: I0297a6063874b9d92100e0dd5123fddfbda932fe
2015-03-14 16:36:18 -07:00
Elliott Hughes
46270d233a adb doesn't actually use libzipfile.
Change-Id: Ia7d22214bc8422c88edaaf9bb716d7e12e0bb381
2015-03-13 09:40:45 -07:00
Dan Albert
bac3474a82 Move adb to C++.
I keep trying to clean things up and needing std::strings. Might as
well just do this now.

usb_linux_client.c is going to stay as C because GCC isn't smart
enough to deal with the designated initializers it uses (though for
some reason it is in C mode).

The Darwin files are staying as C because I don't have a way to test
that they build.

The Windows files are staying as C because while I can actually build
for them, it's slow and painful.

Change-Id: I75367d29205a9049d34460032b3bb36384f43941
2015-03-09 14:06:11 -07:00
Dan Albert
cc731cc767 Test readx/writex (now renamed).
Renamed readx/writex to ReadFdExactly/WriteFdExactly respectively.
These read/write a full fixed-size buffer. If the whole buffer cannot
be read/written, these functions return an error.

Rename write_string to WriteStringFully.

Move the TEMP_FAILURE_RETRY definition in sysdeps.h out of the
!Windows section. It seems Windows won't actually interrupt a call,
but it's easier to just define it than to #ifdef each call.

Change-Id: Ia8ddffa2a52764a2f9a281c96c937660e002b9b9
2015-02-25 15:07:57 -08:00
Dan Albert
7fd821e907 Remove _(GNU|XOPEN)_SOURCE makefile cruft.
None of the functions that require these are used.

Change-Id: I10cffab127795b94340131f8737f7924b9138f9e
2015-02-25 11:08:21 -08:00
Dan Albert
055f1aa4ff Add some basic tests to adb.
Change-Id: I946b5b1e5650540db3b4f75892214c4218b3baf3
2015-02-25 10:57:26 -08:00
Dan Albert
9697ce520d Add a project wide clang switch.
I'll probably make this the default soon, but I'm not brave enough to
do that without checking the recovery image first.

Change-Id: I9cde687b08a588e3797645a308f381e4ec553447
2015-02-24 15:54:34 -08:00
Dan Albert
fdf8722491 Fix Mac build.
Prior to https://android-review.googlesource.com/#/c/134253/ the
makefile had assumed !Windows was the same as Linux, so the Mac was
actually getting all the Linux sources as well. I mistakenly didn't
add fdevent.cpp to the Darwin sources in that change.

Change-Id: I4e12a394e9a2baf7c1e3c711a01a6b5fccbf79d9
2015-02-24 14:27:33 -08:00
Dan Albert
88cf1c8c4a Fix Windows SDK build.
Change-Id: I9c0f9c92c28867ff17f1ec83aac935d18348c335
2015-02-24 14:08:03 -08:00
Dan Albert
3c43858986 Move more into libadb and libadbd.
None of this needs to be shared with minadbd, but these sources are
still needed for anything linking libadb (such as tests).

Change-Id: I3024f714da42364bf27a991986f00676e2bbbf2c
2015-02-20 17:24:30 -08:00
Dan Albert
bf10647b61 Oops. Fix make variable name. Thanks again, make.
Change-Id: Iecbb41acc835bb8eb20b668c89a3ff065470fcb7
2015-02-20 17:20:37 -08:00
Dan Albert
e1ca623faa Lose adb.c and sockets.c to libadb.
Also kill the device side libadb. This was added for the now dead
device side adb, and is no longer used.

Bug: 17626262
Change-Id: I3b28915641fd5b4f16fc86cf1f4f4e9711093001
2015-02-19 13:49:35 -08:00
Dan Albert
bd0b750897 Move adb_main to its own file.
Change-Id: If6e98c089b39f73bd8f4a878a82669bfeee367f3
2015-02-18 18:32:54 -08:00
Dan Albert
e9fca14c9e Move the listener code into its own file.
Change-Id: I7332455ed1a213daedeaa4a81260edf08b2fd131
2015-02-18 18:22:52 -08:00
Dan Albert
ba3a251749 Move the adb auth code into its own file.
Change-Id: I84cf0bd7777f0147119e7c6afc4096c2e93156a2
2015-02-18 18:22:52 -08:00
Dan Albert
21c3eaf4cc Move emulator tracing into its own file.
adb.c is far too monolithic.

Change-Id: I4a9ee97927e4a96a38ea5859d84efac86bfdfc35
2015-02-18 17:21:17 -08:00
Dan Albert
9449376328 Move USB transport code to libadb.
Also note that we need both a libadb and a libadbd (for now) to
differentiate between code using ADB_HOST=1 and ADB_HOST=0.

Bug: 17626262
Change-Id: I873a8fb442a8a69258fe39af17781714a8fae4f6
2015-02-18 10:55:28 -08:00
Elliott Hughes
506aea4361 The bsddroid project has been dead since 2010.
And even if it wasn't, they should probably keep this stuff in their own
repository.

Change-Id: If9fa2e47ee2700098d8a99f6986f7e89fc6dfdf3
2015-01-31 11:24:14 -08:00
Dan Albert
fe68578716 Merge "Fix userdebug build." 2015-01-27 01:30:24 +00:00
Dan Albert
030b76fc1d Fix userdebug build.
Apparently this code I thought was unused is just unused for eng
builds...

Bug: 17626262
Change-Id: I2e5f411a2ead7f23d9f5822935de66c992750a03
2015-01-26 17:14:23 -08:00
Dan Albert
4626b71057 Fix win_sdk build.
Hadn't caught this in the previous submission because I tested the
build with another change on top of it that also fixes this.

Bug: 17626262
Change-Id: Ia40127618a5466e382081760d614ff7fc09d50a3
2015-01-26 17:07:47 -08:00
Dan Albert
630b9afeb0 Begin moving code from adb to libadb.
Much of adb is duplicated in bootable/recovery/minadb and fastboot.
Changes made to adb rarely get ported to the other two, so the trees
have diverged a bit. We'd like to stop this because it is a
maintenance nightmare, but the divergence makes this difficult to do
all at once. For now, we will start small by moving common files into
a static library. Hopefully some day we can get enough of adb in here
that we no longer need minadb.

Bug: 17626262
Change-Id: Ic8d5653bfcc0fec4e1acbece124402355084b864
2015-01-26 16:45:34 -08:00
Paul Lawrence
982089d838 Add adb enable-verity
Note that it is *easy* to break your phone with this feature. It is
not a bug that reenabling verity after changing one byte of the system
partition stops the device booting.

(cherry-pick of 7c442e1700e6312727283db402dec6f666f1b55a.)

Bug: 18529433
Change-Id: I632e91281884471a362960f1ba30312d2669b8ff
2014-12-09 17:04:43 -08:00
Paul Lawrence
ec900bba20 Revert "Revert "Enable verity on userdebug, and add disable-verity to adb""
This reverts commit 152d2d4234.

Fixed build error, and also fixed memory leak spotted from warning.

(cherry-pick of bbb36319119edde9377fb80015235893c30d2bc9.)

Bug: 17691572
Change-Id: I23b5ba537f7b557432041d4338b38b9be434e981
2014-12-09 17:02:17 -08:00
Trevor Drake
b79a2d55f7 Clean up adb/Android.mk
Removed redundant LOCAL_C_INCLUDES.
Switch from using libunz to libz

Change-Id: Ic90c582fa56453bbac09561158e73f240dd47503
2014-12-07 15:13:29 +00:00
Elliott Hughes
c66aed8a14 Remove the adb usb vendor id whitelist.
If there are bad vendors, we should blacklist them. Whitelisting the entire
world is crazy.

Change-Id: I1f4c27fd34fc420e2a3b4b2c8749198030db69f1
2014-11-21 10:44:10 -08:00