Commit graph

600 commits

Author SHA1 Message Date
Ying Wang
42a809ba06 Fix 64-bit host build.
Bug: 13751317
Change-Id: Ibf62935b7d12a55ffc57242a26a2581b52796847
2014-08-14 15:52:54 -07:00
Elliott Hughes
29c5a78fdc Merge "Fix build of adb with gcc-4.9." 2014-08-05 00:30:25 +00:00
Alexander Ivchenko
5372333885 Fix build of adb with gcc-4.9.
Without this patch we get:

system/core/adb/commandline.c:1629:16: error: array subscript is above
array bounds [-Werror=array-bounds]

Change-Id: I494eb8b4d0e8082f8ff57bdd33d8d46c8c481c6f
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
2014-08-06 16:07:17 +04:00
Elliott Hughes
a8d0c4a2b8 Merge "Move host 'get-state' service up so that it works." 2014-08-05 00:30:25 +00:00
Jeff Sharkey
0cc642c82d Partially revert argument escaping.
Commands chained with && need to be passed through literally instead
of always being quoted.

(cherry-pick of 7c460351f53cb683097fe4071b9ec1e4cd7cdf82.)

Bug: 15479704
Change-Id: I2998e40a92a3bfd092098cd526403b469c86c9a6
2014-08-05 22:55:39 +00:00
Jeff Sharkey
dcd2f0ef2f Uniformly escape shell arguments.
Arguments with embedded spaces need to be wrapped in quotes, which
changes the overall escaping strategy.  Instead of mixing the two
strategies, just always wrap arguments in quotes.

(cherry-pick of fd546e8c35341b518873eb4f883afbed92e947af.)

Bug: 15479704
Change-Id: I03eacfa1bd6c220d4ec6617b825ebb0c43c7221e
2014-08-05 22:54:35 +00:00
Simon Ye
dc22c3c7a8 Move host 'get-state' service up so that it works.
Due to previous bad merge, the get-state service was moved out of the
ADB_HOST #ifdef block.

Change-Id: Id4b72a051ff04104659925e63a02eb340db2f807
2014-07-28 11:44:46 -07:00
Elliott Hughes
d235288553 Fix adb "ptsname is not thread-safe; use ptsname_r instead" build break.
Change-Id: I633dc4d6d421862473e7267cc0d2c1b0933392e0
2014-07-29 11:32:16 -07:00
DanielMo
43222b3f0a adb: Add USB vendor ID for SONIM TECHNOLOGIES, INC.
Change-Id: Id66997709fec55b1efd389abf2efa644b9a8ccf4
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-07-25 11:17:55 +08:00
Tim Murray
1efcdeffe5 fix adb build on Darwin
bug 16172793

Change-Id: Ia34b7148afc4c909f29037df91c04d6fd29a731e
2014-07-24 18:33:12 -07:00
Nick Kralevich
9866a66d6d adb: set O_CLOEXEC on lots of file descriptors
Too many leaking FDs.

Fixes bug: https://code.google.com/p/android/issues/detail?id=65857
(and more)

(cherrypicked from commit fe8d7f4f2e)

Change-Id: I67d8683244e54288a8105f6f65ee40abe2378d7e
2014-07-21 19:34:31 -07:00
Greg Hackmann
7046773595 adb: replace utimes() with utime()
Fix the win_sdk host build by replacing utimes() with utime().  utime()
is functionally equivalent to utimes() when dealing with non-fractional
second timestamps, and is supported by the Windows CRT.

(The Windows CRT uses the nonstandard name _utime(), but mingw creates
aliases to the POSIX names.)

Change-Id: I513c6c5de05376c34cbb0894a94259acba8ae6f1
2014-07-21 17:10:34 -07:00
Rom Lemarchand
1b3f2ff028 adb: use oom_score_adj instead of oom_adj
(cherry picked from commit 07ce7cab72)

Change-Id: I1730d1df34039a5502200002ac813ce96a3eaa1a
2014-07-18 21:55:38 -07:00
Jeff Sharkey
eb97987332 Add "exec" service: shell commands with no pty.
To facilitate device scripts that want to read/write binary data from
the host side, this change introduces a new "exec" service that
behaves like "shell" but without creating a pty, which would otherwise
mangle binary data.

After forking, it hooks up stdin/stdout of the child process to
the socket connected through to the host.  The adb transport doesn't
support shutdown(), so the host can't half-close the socket and wait
for device termination.  Instead, the host side now has two explicit
commands "exec-in" and "exec-out" for either sending or receiving
data.

Teach host side copy_to_file() to deal with stdin/stdout special
cases.  Switch device side backup/restore services to use the new
create_subproc_raw under the hood.

(cherry picked from commit 5d9d434efa)

Change-Id: I42c18cb5bb907449b458c94450ef6c584d84ecdb
2014-07-18 21:46:23 -07:00
Lajos Molnar
4b35c01e3e adb: added support for adb pull -a to preserve time stamps and mode
Added -a flag to adb pull that preserves time and mode.  Mode is
subjected to umask for security.  We only receive modification
time from adb server, so creation time will be set to the modification
time as well.

Signed-off-by: Lajos Molnar <lajos@google.com>

(cherry picked from commit de8ff4adca)

Change-Id: I03bb5cc14ce542299cf3b221a8be318a28ee8a8d
2014-07-18 21:46:18 -07:00
Elliott Hughes
b4dd6ef223 Fix implicit declaration of function 'prctl' in adb.
Change-Id: I9f14cabbb36d658510c11833b3314565a2445e10
2014-07-18 16:44:58 -07:00
Badhri Jagan Sridharan
77a2c22dcb Merge "adbd: adb root should terminate adbd only if it's debuggable" 2014-07-09 21:40:17 +00:00
Elliott Hughes
20bda70f9a Merge "Add Smartisan usb config" 2014-06-23 21:50:22 +00:00
DanielMo
8c4c8e8988 adb: Add USB vendor ID for Honeywell
Change-Id: Ib92eca23a6c75ec9323bb1b0e7d7f8cd5f9ca207
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-06-19 16:02:14 +08:00
Nick Kralevich
e5cbf4e044 adbd: unconditionally call setgroups
We should ensure that the appropriate supplementary groups are
set, regardless of whether we're running UID=0 or UID=shell.

Change-Id: I3a1624a574102be08176a41f9c7eb5f82af2b3e5
2014-06-18 11:24:27 -07:00
xuefeng cai
4f8d3be3b2 Add gionee USB vendor id.
Change-Id: I3745f0e8462d0bffcd2eb4d926a9d2f9af8578f9
2014-06-16 17:29:42 +00:00
Nick Kralevich
8fcb631389 adb: avoid leaking file descriptors
If an adb shell connection comes in while taking a screenshot,
an open pipe file descriptor will be leaked to the shell process.
This causes SELinux denials of the form:

  avc: denied { read } for path="pipe:[21838]" dev="pipefs" ino=21838 scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=fifo_file permissive=0
  avc: denied { write } for path="pipe:[21838]" dev="pipefs" ino=21838 scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=fifo_file permissive=0

Set O_CLOEXEC on the pipe connections, to avoid leaking them
across an exec boundary.

Bug: 15437785
Change-Id: Id2304b316bd7082d8baac246dce1f0e0e26e9197
2014-06-05 20:26:25 -07:00
Narayan Kamath
4e26c95a63 Merge "Skip the "--abi" flag on "adb install" if present." 2014-06-03 09:58:24 +00:00
Narayan Kamath
a284f8b214 Skip the "--abi" flag on "adb install" if present.
This flag needs to be passed through to the package manager.
Without this change, the argument to this flag is interpreted
as a filename.

NOTE: If we don't want to add special treatment for this flag,
we'll have to assume that all flags with a -- prefix have an
argument, and that isn't necessarily true.

Change-Id: I78c3fa842bc24148d83d7278e6dee395686240a0
2014-05-29 15:54:10 +01:00
Elliott Hughes
769db021e6 am b24085d5: Merge "adb: Add USB vendor ID for Unowhy"
* commit 'b24085d55b082d802eba699243dba26fbc6ac712':
  adb: Add USB vendor ID for Unowhy
2014-05-27 21:29:15 +00:00
Wing Tseng
56266c75e2 adb: Add USB vendor ID for Unowhy
Change-Id: I8bab07734d5b6acb4d8ceaf45b0bab0723f5fe03
Signed-off-by: Wing Tseng <Wing_Tseng@pegatroncorp.com>
2014-05-27 14:23:11 -07:00
David 'Digit' Turner
c335887516 am 6e7343b8: Merge "adb: implement "adb reverse <local> <remote>""
* commit '6e7343b8993fecb2f0600a9e5cff91dd4480a877':
  adb: implement "adb reverse <local> <remote>"
2014-05-27 16:33:16 +00:00
David 'Digit' Turner
2525869419 adb: implement "adb reverse <local> <remote>"
This implements the logical opposite of 'adb forward', i.e.
the ability to reverse network connections from the device
to the host.

This feature is very useful for testing various programs
running on an Android device without root or poking at the
host's routing table.

Options and parameters are exactly the same as those for
'adb forward', except that the direction is reversed.

Examples:

  adb reverse tcp:5000 tcp:6000
    connections to localhost:5000 on the device will be
    forwarded to localhost:6000 on the host.

  adb reverse --no-rebind tcp:5000 tcp:6000
    same as above, but fails if the socket is already
    bound through a previous 'adb reverse tcp:5000 ...'
    command.

  adb reverse --list
    list all active reversed connections for the target
    device. Note: there is no command to list all
    reversed connections for all devices at once.

  adb reverse --remove tcp:5000
    remove any reversed connection on the device from
    localhost:5000

  adb reverse --remove-all
    remove all reversed connections form the current
    device.

Reversed connections are tied to a transport, in other
words, they disappear as soon as a device is disconnected.

Simple testing protocol:

  adb forward tcp:5000 tcp:6000
  adb reverse tcp:6000 tcp:7000
  nc -l localhost 7000

in another terminal:
  echo "Hello" | nc localhost 5000

Will print "Hello" on the first terminal.

Change-Id: I761af790cdb06829b68430afa4145a919fa0e6d5
2014-05-27 16:42:13 +02:00
Colin Cross
28c305183a am 1742b7d2: Merge "Modify VID for Compal"
* commit '1742b7d218706c596e6b40c89a6660f30bdba022':
  Modify VID for Compal
2014-05-21 19:28:43 +00:00
Colin Cross
1742b7d218 Merge "Modify VID for Compal" 2014-05-21 19:24:53 +00:00
Elliott Hughes
6dfb039b0b am 4a343436: Merge "Fix win32 undefined reference to `_socket_network_client_timeout\'."
* commit '4a343436e01b07c21c043f8a903689f70000ca73':
  Fix win32 undefined reference to `_socket_network_client_timeout'.
2014-05-20 19:21:36 +00:00
Elliott Hughes
0bff5bd952 Fix win32 undefined reference to `_socket_network_client_timeout'.
Change-Id: I063213957b8452f4690da0f64872075f7c27b4cd
2014-05-20 12:13:29 -07:00
Elliott Hughes
796b20157f am 51e27f95: Merge "Fix win32 implicit declaration of function socket_network_client_timeout."
* commit '51e27f955b79846e36097532a725f4b7a3eefef8':
  Fix win32 implicit declaration of function socket_network_client_timeout.
2014-05-20 15:55:43 +00:00
Elliott Hughes
b911cf0af4 Fix win32 implicit declaration of function socket_network_client_timeout.
Change-Id: Ic6070855a21920384c555c9c82b9a2e4a776cbae
2014-05-20 08:51:15 -07:00
Elliott Hughes
0e71e3ab9c am 9cae50b3: Merge "Bound the ADB connect time with a non-blocking connect"
* commit '9cae50b38d6a58efe0799ef3697f594cb4b100f9':
  Bound the ADB connect time with a non-blocking connect
2014-05-19 23:22:21 +00:00
Ken Lierman
aecc6a6657 Bound the ADB connect time with a non-blocking connect
After a disconnect, the initial blocking connect takes
a long time to return, while subsequent calls return
quicks.  Switch to a non-blocking connect to make the
re-connect time more consistent and faster overall.

Change-Id: I21d02b22a8eb9a457c2f1fa95eb17894d5612ccd
Signed-off-by: Ken Lierman <ken.lierman@windriver.com>
Reviewed-by: Gumbel, Matthew K <matthew.k.gumbel@intel.com>
Reviewed-by: Jovanovic, Radivoje <radivoje.jovanovic@intel.com>
Reviewed-by: Boie, Andrew P <andrew.p.boie@intel.com>
2014-05-19 16:16:42 -07:00
Kenny Root
c563c38d06 am 905874ab: Merge "adb: avoid compilation errors for unused results"
* commit '905874abe45279d7c668e590d404880dd91b1869':
  adb: avoid compilation errors for unused results
2014-05-13 16:21:12 +00:00
Kenny Root
1bd41b1399 adb: avoid compilation errors for unused results
The BIO_CTRL_FLUSH function for files doesn't return anything useful
from the underlying fflush call, so it is safe to ignore this.

Change-Id: If33a7efbbaaf158e3da1cd72d0a56da1d3b82fd9
2014-05-13 09:12:54 -07:00
Mark Salyzyn
328746da80 am 129e9dad: Merge changes Idfd1a114,If725a1cb,I61211165,If9a05ccb
* commit '129e9dada707d66eb3242b666b6187a031dc410a':
  adb: turn on -Werror
  netcfg: turn on -Werror
  mkbootimg: turn on -Werror
  gpttool: turn on -Werror
2014-05-07 23:12:57 +00:00
Mark Salyzyn
129e9dada7 Merge changes Idfd1a114,If725a1cb,I61211165,If9a05ccb
* changes:
  adb: turn on -Werror
  netcfg: turn on -Werror
  mkbootimg: turn on -Werror
  gpttool: turn on -Werror
2014-05-07 23:10:40 +00:00
Ying Wang
1e6cd741fd am 803fb62b: Merge "Remove unused LOCAL_LDLIBS."
* commit '803fb62bb49b551afff546b4748d2d3e9ec54af1':
  Remove unused LOCAL_LDLIBS.
2014-05-07 22:54:26 +00:00
Ying Wang
9f437d7181 Remove unused LOCAL_LDLIBS.
Change-Id: I42aeb7668183e7a06207ee063f6eee4d37d66c6e
2014-05-07 15:36:05 -07:00
Mark Salyzyn
60299dfd6a adb: turn on -Werror
- Deal with some -Wunused issues

Change-Id: Idfd1a114e68ae637978b52fde5144d0dca0ec79f
2014-05-05 10:30:06 -07:00
jzhuan5
1297d22bc9 adbd: adb root should terminate adbd only if it's debuggable
adb root command will terminate adbd when closing the socket if current
user id is not root. This works for userdebug build, as adb root causes
re-enumeration.

But for user build, adb root command won't cause re-enumeration, and if
adbd is terminated and restarted, it will be in offline state, thus it
won't send any thing to host.

Change-Id: I81216a3b3da888cd9b236060cf745175f6d93c60
Author: jzhuan5 <jin.can.zhuang@intel.com>
Signed-off-by: Bo Huang <bo.b.huang@intel.com>
2014-05-05 17:20:00 +08:00
herman_lin
fd18127eb7 Modify VID for Compal
The original definition of VENDOR_ID_COMPAL is for Compal Communications, Inc.
But Compal Communications, Inc(CCI) had been merged into Compal Electronics, Inc(CEI) at April of 2014
So VENDOR_ID_COMPAL should be changed from 0x1219(CCI's VID) to 0x04B7(CEI's VID).
And add one new definition(VENDOR_ID_COMPALCOMM) for CCI to maintain old devices that use CCI's VID.
	modified:   adb/usb_vendors.c

Change-Id: I9e9a96f6cc81273ff2c9353a13e7ce3b0583396b
2014-05-05 03:43:20 +08:00
Bill Yi
1333e012ee Merge commit '4102af05a86aae36d2560fd8b3f740a52399342c' into HEAD 2014-04-29 16:07:40 -07:00
DanielMo
76b526a2ca adb: Add USB vendor ID for Prestigio
Change-Id: Ib9e79043961b9b1fa27d87f5bc815000e7965706
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-04-16 12:15:21 +08:00
Bao Haojun
ae1f009430 Add Smartisan usb config
Change-Id: Ifd921f1dc0d2163230337805c3cf726f371300b0
Signed-off-by: Bao Haojun <baohaojun@gmail.com>
2014-04-11 19:17:39 +08:00
DanielMo
2b6612ff96 adb: Add USB vendor ID for Intermec Technologies Corp.
Change-Id: I6429bca087523829a13f905ae9dfa5f43b7abf8b
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-03-26 15:33:23 +08:00
JP Abgrall
5a5ab405cd am 4db6ce8e: Merge "Adding documentation on the sync part of the adb protocol previously missing."
* commit '4db6ce8e353458de751394102084bb3a304a7ff6':
  Adding documentation on the sync part of the adb protocol previously missing.
2014-03-20 22:12:43 +00:00