Commit graph

849 commits

Author SHA1 Message Date
Elliott Hughes
20bda70f9a Merge "Add Smartisan usb config" 2014-06-23 21:50:22 +00:00
Rom Lemarchand
07ce7cab72 adb: use oom_score_adj instead of oom_adj
Change-Id: I76c6ce83d7d400c8b84bfece5d30189640cb2505
2014-06-20 23:40:18 +00:00
Colin Cross
b10fb88e1e am d7d9b6fc: am f02fd9f0: am 5e504a4e: Merge "adb: Add USB vendor ID for Honeywell"
* commit 'd7d9b6fcaa415ea6251e45d84b95a95740ea807e':
  adb: Add USB vendor ID for Honeywell
2014-06-19 15:48:25 +00:00
Colin Cross
d7d9b6fcaa am f02fd9f0: am 5e504a4e: Merge "adb: Add USB vendor ID for Honeywell"
* commit 'f02fd9f0b061d29bb872664479ed4a5949d23ac9':
  adb: Add USB vendor ID for Honeywell
2014-06-19 15:44:14 +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
4224edf51d am 89e4fad0: am 4e6aa6a2: Merge "adbd: unconditionally call setgroups"
* commit '89e4fad09e1ae765ab0be1580a468bc0837ef7e4':
  adbd: unconditionally call setgroups
2014-06-18 20:07:54 +00:00
Nick Kralevich
000a62f644 am 4224edf5: am 89e4fad0: am 4e6aa6a2: Merge "adbd: unconditionally call setgroups"
* commit '4224edf51dcddf9e014b198bb23fc40ef61a5834':
  adbd: unconditionally call setgroups
2014-06-18 21:40:27 +00: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
Elliott Hughes
def14fc4ed am cd0d5935: am 6c65cd5d: am 60218f19: Merge "Add gionee USB vendor id."
* commit 'cd0d593569d7f2b8f8ec81ab3ef6dd942230e973':
  Add gionee USB vendor id.
2014-06-16 18:11:41 +00:00
Elliott Hughes
cd0d593569 am 6c65cd5d: am 60218f19: Merge "Add gionee USB vendor id."
* commit '6c65cd5db84361c66983903638ddb251762f9151':
  Add gionee USB vendor id.
2014-06-16 17:41:49 +00:00
xuefeng cai
4f8d3be3b2 Add gionee USB vendor id.
Change-Id: I3745f0e8462d0bffcd2eb4d926a9d2f9af8578f9
2014-06-16 17:29:42 +00:00
Jeff Sharkey
7c460351f5 Partially revert argument escaping.
Commands chained with && need to be passed through literally instead
of always being quoted.

Bug: 15479704
Change-Id: I2998e40a92a3bfd092098cd526403b469c86c9a6
2014-06-11 08:40:58 -07:00
Jeff Sharkey
fd546e8c35 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.

Bug: 15479704
Change-Id: I03eacfa1bd6c220d4ec6617b825ebb0c43c7221e
2014-06-10 12:28:32 -07:00
Nick Kralevich
5c70f7e310 am f3af14e6: am ef47eb19: am 30136150: Merge "adb: avoid leaking file descriptors"
* commit 'f3af14e6df266f466e0bf7868d002cfe8104c128':
  adb: avoid leaking file descriptors
2014-06-07 00:19:51 +00:00
Nick Kralevich
f3af14e6df am ef47eb19: am 30136150: Merge "adb: avoid leaking file descriptors"
* commit 'ef47eb1948ba394866f53c41c459561fc372a3b5':
  adb: avoid leaking file descriptors
2014-06-07 00:16:32 +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
8f4ac8e1d3 am 7cf8e1cb: am 4e26c95a: Merge "Skip the "--abi" flag on "adb install" if present."
* commit '7cf8e1cb88c44963ccb2128113d8a804d85645b9':
  Skip the "--abi" flag on "adb install" if present.
2014-06-03 13:58:44 +00:00
Narayan Kamath
7cf8e1cb88 am 4e26c95a: Merge "Skip the "--abi" flag on "adb install" if present."
* commit '4e26c95a6363da4885bb9178c9d42c273b357043':
  Skip the "--abi" flag on "adb install" if present.
2014-06-03 13:29:03 +00:00
Narayan Kamath
4e26c95a63 Merge "Skip the "--abi" flag on "adb install" if present." 2014-06-03 09:58:24 +00:00
Jeff Sharkey
b81708146f Merge "Add "exec" service: shell commands with no pty." 2014-06-02 16:54:23 +00:00
Jeff Sharkey
5d9d434efa 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.

Change-Id: I5993049803519d3959761f2363037b02c50920ee
2014-05-30 11:27:56 -07: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
bccac026e9 am 8ed26bd6: am 769db021: am b24085d5: Merge "adb: Add USB vendor ID for Unowhy"
* commit '8ed26bd6531a8d52dcaff6c14b6fc59749791679':
  adb: Add USB vendor ID for Unowhy
2014-05-27 21:49:02 +00:00
Elliott Hughes
8ed26bd653 am 769db021: am b24085d5: Merge "adb: Add USB vendor ID for Unowhy"
* commit '769db021e6b61d10c13a7b17a72750f18ebdee16':
  adb: Add USB vendor ID for Unowhy
2014-05-27 21:32:01 +00: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
7291ac6082 am 97267755: am c3358875: am 6e7343b8: Merge "adb: implement "adb reverse <local> <remote>""
* commit '972677557bd2c3a0678a945765783e85c7ec7b9c':
  adb: implement "adb reverse <local> <remote>"
2014-05-27 16:43:45 +00:00
David 'Digit' Turner
972677557b am c3358875: am 6e7343b8: Merge "adb: implement "adb reverse <local> <remote>""
* commit 'c3358875169b920847a72428f4e8b8f09f7bdf05':
  adb: implement "adb reverse <local> <remote>"
2014-05-27 16:36:30 +00: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
6fb1557fda am b696bec3: am 28c30518: am 1742b7d2: Merge "Modify VID for Compal"
* commit 'b696bec3541dc3091fb7c8764750f8ba21f64636':
  Modify VID for Compal
2014-05-21 20:49:01 +00:00
Colin Cross
b696bec354 am 28c30518: am 1742b7d2: Merge "Modify VID for Compal"
* commit '28c305183a6596eb3241771422d22351fbeaa9fb':
  Modify VID for Compal
2014-05-21 19:32:15 +00: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
b65208d1a9 am f7a7e3c3: am 6dfb039b: am 4a343436: Merge "Fix win32 undefined reference to `_socket_network_client_timeout\'."
* commit 'f7a7e3c301fdf7d98d8bcabf6fefb0fcf5bbf90d':
  Fix win32 undefined reference to `_socket_network_client_timeout'.
2014-05-20 20:18:01 +00:00
Elliott Hughes
f7a7e3c301 am 6dfb039b: am 4a343436: Merge "Fix win32 undefined reference to `_socket_network_client_timeout\'."
* commit '6dfb039b0ba56576b4ed043e02ae43fb6afd42aa':
  Fix win32 undefined reference to `_socket_network_client_timeout'.
2014-05-20 19:24:31 +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
fa59e0a487 am 9bcc5512: am 796b2015: am 51e27f95: Merge "Fix win32 implicit declaration of function socket_network_client_timeout."
* commit '9bcc55123ec814074417994db99730929a31fec8':
  Fix win32 implicit declaration of function socket_network_client_timeout.
2014-05-20 18:15:58 +00:00
Elliott Hughes
9bcc55123e am 796b2015: am 51e27f95: Merge "Fix win32 implicit declaration of function socket_network_client_timeout."
* commit '796b20157f75e46ad91b7d894796e0ba55a7766e':
  Fix win32 implicit declaration of function socket_network_client_timeout.
2014-05-20 16:00:25 +00: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
3edc25271f am b42f1413: am 0e71e3ab: am 9cae50b3: Merge "Bound the ADB connect time with a non-blocking connect"
* commit 'b42f141315ae0929325335645d397db04a500c88':
  Bound the ADB connect time with a non-blocking connect
2014-05-20 00:23:08 +00:00
Elliott Hughes
b42f141315 am 0e71e3ab: am 9cae50b3: Merge "Bound the ADB connect time with a non-blocking connect"
* commit '0e71e3ab9cf66f41645ea286c7e62ed2b657ca38':
  Bound the ADB connect time with a non-blocking connect
2014-05-19 23:26:22 +00: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
Ingo Rohloff
58b01e0187 ADB on linux: Handle USB SuperSpeed extra Descriptors
Under Linux, ADB manually parses USB Descriptors to check for
possible ADB USB Interfaces. USB Devices connected with SuperSpeed
will exhibit extra USB SuperSpeed Endpoint Companion Descriptors.
This patch handles these USB SuperSpeed specific USB Descriptors.

Change-Id: Icd1e5fdde0b324c7df4f933583499f2c52a922f3
Signed-off-by: Ingo Rohloff <lundril@gmx.de>
2014-05-16 22:25:45 +02:00
Bao Haojun
cdb1b1b84d Fix deadlocks.
1. Close pipe fds[1] as soon as possible. Otherwise it may block when
   reading from fds[0] even though the child process has exited early
   and closed its copy of fds[1].

2. Waitpid after pipe is closed. Otherwise the screencap child process
   may block while writing fds[1], because the fds[0] is not closed
   yet. If we close fds[0] first, then the screencap child process will
   die because of SIGPIPE, and waitpid will return correctly.

Change-Id: I433c95a5ba2eb3045727fc39a49fd9557fb1a1d1
Signed-off-by: Bao Haojun <baohaojun@gmail.com>
2014-05-14 21:45:11 +08:00
Kenny Root
910bca6850 am 57e53ed4: am c563c38d: am 905874ab: Merge "adb: avoid compilation errors for unused results"
* commit '57e53ed4189cc49844e6afcea2a5861fd8ca93f1':
  adb: avoid compilation errors for unused results
2014-05-13 16:31:54 +00:00
Kenny Root
57e53ed418 am c563c38d: am 905874ab: Merge "adb: avoid compilation errors for unused results"
* commit 'c563c38d06e3af61ab8cf1c26536106985fec073':
  adb: avoid compilation errors for unused results
2014-05-13 16:26:13 +00: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
d2baee2f47 am e7597115: am 328746da: am 129e9dad: Merge changes Idfd1a114,If725a1cb,I61211165,If9a05ccb
* commit 'e75971157c46a0fc57194a75d4dde0920f60f427':
  adb: turn on -Werror
  netcfg: turn on -Werror
  mkbootimg: turn on -Werror
  gpttool: turn on -Werror
2014-05-08 18:24:02 +00:00
Ying Wang
da6a0aa0df am b18da571: am 1e6cd741: am 803fb62b: Merge "Remove unused LOCAL_LDLIBS."
* commit 'b18da571f90eebedd99fe5607a6b0d7ae4e91893':
  Remove unused LOCAL_LDLIBS.
2014-05-08 18:23:57 +00:00
Mark Salyzyn
e75971157c am 328746da: am 129e9dad: Merge changes Idfd1a114,If725a1cb,I61211165,If9a05ccb
* commit '328746da8090a549e432da2358585b101e30d753':
  adb: turn on -Werror
  netcfg: turn on -Werror
  mkbootimg: turn on -Werror
  gpttool: turn on -Werror
2014-05-07 23:15:40 +00: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
b18da571f9 am 1e6cd741: am 803fb62b: Merge "Remove unused LOCAL_LDLIBS."
* commit '1e6cd741fd130e5916337eb75c9ceef2152035d2':
  Remove unused LOCAL_LDLIBS.
2014-05-07 23:01:12 +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
Greg Hackmann
7a5e2bd062 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-05-06 08:48:18 -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
Lajos Molnar
de8ff4adca 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.

Change-Id: I37c0b94741ed464f19025d25dea3ff2f6ac43e7f
Signed-off-by: Lajos Molnar <lajos@google.com>
2014-05-02 11:01:38 -07:00
Bill Yi
1333e012ee Merge commit '4102af05a86aae36d2560fd8b3f740a52399342c' into HEAD 2014-04-29 16:07:40 -07:00
Colin Cross
48858b21b2 am c33702dd: am 4785ea60: Merge "adb: Add USB vendor ID for Prestigio"
* commit 'c33702dd92da5f41d17ee9a64a8a0ff67f6e9d1b':
  adb: Add USB vendor ID for Prestigio
2014-04-18 00:52:44 +00: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
Jeff Brown
83ec001086 am a77bef47: Document the adb install -d option.
* commit 'a77bef47decf2c0818397aced983999e235aa82f':
  Document the adb install -d option.
2014-04-15 20:36:55 +00:00
Jeff Brown
a77bef47de Document the adb install -d option.
Change-Id: Ife0da42c22e4408dc5c07ac0f20e0ecbbde20832
2014-04-15 13:34:04 -07: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
Colin Cross
d3113afc47 am 707f5b40: am 6940bc08: Merge "adb: Add USB vendor ID for Intermec Technologies Corp."
* commit '707f5b401ec354851c0e1b22c8ddb6aba45fba66':
  adb: Add USB vendor ID for Intermec Technologies Corp.
2014-03-26 18:26:14 +00: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
JP Abgrall
ff66a06851 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:11:56 +00:00
JP Abgrall
4db6ce8e35 Merge "Adding documentation on the sync part of the adb protocol previously missing." 2014-03-20 21:25:42 +00:00
Samuel Carlsson
912d5dddf8 Adding documentation on the sync part of the adb protocol previously missing.
In the SERVICES.TXT a missing documentation file is mentioned - SYNC.TXT. This file is supposed to contain all the godie bits of the adb protocol for pushing and pulling files. I've read the source code and documented this in the file SYNC.TXT. I've used my own documentation to create a java implementation to verify the documentation here: https://github.com/vidstige/jadb

Added line breaks at 78 characters. Added comments about remote files might be deleted.

Change-Id: I48c87c2a9fb5b59b85c72679124dfbbfa9a701bc
Signed-off-by: Samuel Carlsson <samuel.carlsson@gmail.com>
2014-03-20 20:36:46 +01:00
David 'Digit' Turner
111c882b3c am ee223d50: Merge "adb: Increase the max number of emulator instances to 64"
* commit 'ee223d50a009af39be577c30cc35257c751f05a1':
  adb: Increase the max number of emulator instances to 64
2014-03-14 20:35:08 +00:00
David 'Digit' Turner
7cb1504e8a am ee223d50: Merge "adb: Increase the max number of emulator instances to 64"
* commit 'ee223d50a009af39be577c30cc35257c751f05a1':
  adb: Increase the max number of emulator instances to 64
2014-03-14 20:34:26 +00:00
JP Abgrall
648f4113bc am 5fb1a34a: Merge "Added transfer progress reporting for push and pull commands."
* commit '5fb1a34af4128bfe7332b02e31b146a82bc2872d':
  Added transfer progress reporting for push and pull commands.
2014-03-13 15:54:17 +00:00
David 'Digit' Turner
094fd86b14 adb: Increase the max number of emulator instances to 64
When the ADB server starts, it probes the localhost ports to find
existing emulator instances, starting from 5555 with increments of
2, and stopping after ADB_LOCAL_TRANSPORT_MAX tries, which was
set to 16.

This means that the ADB server could not detect on startup more
than 16 existing emulator instances.

This increases the limit to 64, to match a corresponding change
on the emulator side.

  See https://android-review.googlesource.com/#/c/83553/

Change-Id: I35c69f8017298c3e5797bd396b8d788d44eaa00f
2014-03-13 11:21:58 +01:00
JP Abgrall
73690b24c6 am 5fb1a34a: Merge "Added transfer progress reporting for push and pull commands."
* commit '5fb1a34af4128bfe7332b02e31b146a82bc2872d':
  Added transfer progress reporting for push and pull commands.
2014-03-12 02:57:29 +00:00
Mark Lindner
76f2a93b18 Added transfer progress reporting for push and pull commands.
Added a new '-p' switch to the 'push' and 'pull' commands that outputs
the file transfer progress (bytes transmitted, total bytes, and % done).
This provides useful feedback when transferring large files, and also
makes it possible for other tools to easily monitor the progress of a
forked push/pull command.

Change-Id: Iee6f42f5bd41292e5bc80fba779f526f0072e356
2014-03-11 19:31:26 -07:00
JP Abgrall
66146c40f7 am 44390474: Merge "adb: Don\'t unlink special files on sync failure."
* commit '443904746301e4d519e51075487ea4c8b9a860e3':
  adb: Don't unlink special files on sync failure.
2014-03-11 18:51:48 +00:00
JP Abgrall
8a00ce939a am b2c34ece: Merge "adb: Don\'t clobber block devices during push"
* commit 'b2c34ece647c212baa30c474394c498a2d6dd61f':
  adb: Don't clobber block devices during push
2014-03-11 18:51:48 +00:00
JP Abgrall
40b735f9b9 am 1367854a: Merge "adb: fix windows build after "forward --list" fix."
* commit '1367854a891090d1be1edfb12515691b20b350cf':
  adb: fix windows build after "forward --list" fix.
2014-03-11 18:42:20 +00:00
JP Abgrall
a4a9e64668 am 66e95d76: Merge "Fix adb forward --list when forwarding a lot"
* commit '66e95d76c47a3a099931bbebe7f4a0af4d3f7fbb':
  Fix adb forward --list when forwarding a lot
2014-03-11 18:42:18 +00:00
JP Abgrall
b4f1b3ca65 am 44390474: Merge "adb: Don\'t unlink special files on sync failure."
* commit '443904746301e4d519e51075487ea4c8b9a860e3':
  adb: Don't unlink special files on sync failure.
2014-03-08 01:56:37 +00:00
JP Abgrall
270ebefc6c am b2c34ece: Merge "adb: Don\'t clobber block devices during push"
* commit 'b2c34ece647c212baa30c474394c498a2d6dd61f':
  adb: Don't clobber block devices during push
2014-03-08 01:56:36 +00:00
JP Abgrall
55b6c843a6 adb: Don't unlink special files on sync failure.
adb push some_disk_image /dev/block/mmcblk0p9
should not unlink the dev just because adb was ctrl-c'd.

Change-Id: I1b6669e8dba1f80fc1438b8deb618180b7e9a1b2
Signed-off-by: JP Abgrall <jpa@google.com>
2014-03-07 17:31:25 -08:00
JP Abgrall
4ce2f838e7 adb: Don't clobber block devices during push
In the past, an adb push would ALWAYS unlink the target path.
Now, we only links and regular files (and links).
This allows the following to work:

   adb shell ls -l /dev/block/mmcblk0p8
     # brw------- root     root     179,   8 2013-11-28 07:43 mmcblk0p8
   adb push n7.jpa.mda.post_jb_encryption.raw  /dev/block/mmcblk0p8

Bug: 11984121
Change-Id: I982c7a1cd87986621f2bebdcb41c4e281f67f772
2014-03-07 17:29:39 -08:00
JP Abgrall
ecac99b54c am 1367854a: Merge "adb: fix windows build after "forward --list" fix."
* commit '1367854a891090d1be1edfb12515691b20b350cf':
  adb: fix windows build after "forward --list" fix.
2014-03-07 03:47:03 +00:00
JP Abgrall
5b0bb4898c adb: fix windows build after "forward --list" fix.
EWOULDBLOCK is not there on windows.
It gets translated by the adb_write() wrapper into EGAIN.
But the Linux one does not translate EWOULDBLOCK into EGAIN.
Without EWOULDBLOCK, it works just fine.

Change-Id: Ic293be392aa4364637428ea94ef87890ffa09b9b
Signed-off-by: JP Abgrall <jpa@google.com>
2014-03-06 19:40:45 -08:00
JP Abgrall
9f573bb362 am 66e95d76: Merge "Fix adb forward --list when forwarding a lot"
* commit '66e95d76c47a3a099931bbebe7f4a0af4d3f7fbb':
  Fix adb forward --list when forwarding a lot
2014-03-07 03:04:44 +00:00
Nick Kralevich
6e94c5764b am 2e7347d6: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."
* commit '2e7347d617b02b13d227bb4cecf6bd69b7b20fa9':
  Convert all selinux_android_restorecon and _setfilecon calls to new API.
2014-03-07 02:29:38 +00:00
Nick Kralevich
3530b9cd46 am 02916aa2: Remove obsolete vdc call.
* commit '02916aa20e3ffbe4b738bb12dc1607a7ec6a8c37':
  Remove obsolete vdc call.
2014-03-04 08:23:06 +00:00
Nick Kralevich
02916aa20e Remove obsolete vdc call.
Since ca8e66a8b0, init has
been handling reboots and filesystem unmounts. Remove obsolete
call to vdc.

Bug: 12504045
Change-Id: If8704ca042cb3a68857743b9973e48c52e7eb881
(cherry picked from commit 225459a5da)
2014-03-04 04:54:00 +00:00
Snild Dolkow
2264e7cfef Fix adb forward --list when forwarding a lot
The list action had some problems with large numbers of forwards:
 * adb_query() limited replies to 1024 B (and the print was useless)
 * the reply header's length could overflow (also in other commands)
 * ...and the client had no way of detecting it
 * writex() didn't retry on EAGAIN ("Resource temporarily unavailable")

This patch makes all "OKAY%04x" replies use a common function which
checks the length and limits it to 0xffff. This means that the client
can easily check for truncated replies.

Before: forward --list starts failing at 15-30 forwards (depending on
device serial and forward spec lengths).

After: no problems with forward --list.

Change-Id: Ie1e82c4d622f5c56e51abb26533ba17d40459914
2014-02-21 14:57:02 +01:00
Nick Kralevich
488b5eafe3 am 2e7347d6: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."
* commit '2e7347d617b02b13d227bb4cecf6bd69b7b20fa9':
  Convert all selinux_android_restorecon and _setfilecon calls to new API.
2014-02-12 23:19:02 +00:00
Stephen Smalley
27a93650c0 Convert all selinux_android_restorecon and _setfilecon calls to new API.
libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-07 09:38:32 -05:00
Mark Salyzyn
3a5f305062 am 7b9bb36a: am 0256e1f6: am d2acdd82: Merge changes I70ab37d5,I716f89c0,I34c96adf,I77650923,I35b0d1ee, ...
* commit '7b9bb36ade6c8fa2e77416143847b019ddda9e95': (29 commits)
  libsysutils: SocketListener export release
  libsysutils: Add iovec/runOnEachSocket
  liblog: support struct logger_event_v2 format
  liblog: update timestamp on NOTICE file
  libcutils: resolve warning in iosched_policy.c
  liblog: Add const pedantics
  logcat: Add -T flag (-t w/o assumption of -d)
  logcat: Add logcat test suite
  liblog: Add cpu utilization test
  liblog: Add liblog test suite
  debuggerd: Support newline split in log messages
  liblog: deprecate export LOGGER ioctl definitions
  liblog: deprecate export of LOGGER_LOG_* defines
  liblog: Add README
  liblog: resolve build warning messages
  liblog: high CPU usage from logcat
  liblog: fix build again
  liblog: drop use of sys/cdefs.h
  liblog: git_master@964770 build problem
  logcat: Incorporate liblog reading API
  ...
2014-01-28 21:20:39 +00:00
Mark Salyzyn
d2acdd82e6 Merge changes I70ab37d5,I716f89c0,I34c96adf,I77650923,I35b0d1ee, ...
* changes:
  libsysutils: SocketListener export release
  libsysutils: Add iovec/runOnEachSocket
  liblog: support struct logger_event_v2 format
  liblog: update timestamp on NOTICE file
  libcutils: resolve warning in iosched_policy.c
  liblog: Add const pedantics
  logcat: Add -T flag (-t w/o assumption of -d)
  logcat: Add logcat test suite
  liblog: Add cpu utilization test
  liblog: Add liblog test suite
  debuggerd: Support newline split in log messages
  liblog: deprecate export LOGGER ioctl definitions
  liblog: deprecate export of LOGGER_LOG_* defines
  liblog: Add README
  liblog: resolve build warning messages
  liblog: high CPU usage from logcat
  liblog: fix build again
  liblog: drop use of sys/cdefs.h
  liblog: git_master@964770 build problem
  logcat: Incorporate liblog reading API
  debuggerd: Incorporate liblog reading API
  liblog: Interface to support abstracting log read
  adb: deprecate legacy log service interface
  adb: regression from Move list.c to inlines
  liblog: whitespace cleanup
  libcutils: bug str_parms.c:str_parms_get_float().
  libcutils: UNUSED argument warnings
  libsysutils: Get rid of warnings
  libcutils: Move list.c to inlines on list.h
2014-01-28 21:09:37 +00:00
Benoit Goby
119dbff9c1 am bbc92ee7: am 68a74ec4: am 6ddabb7a: Merge "adbd: Don\'t close/reopen FFS ep0 on disconnect"
* commit 'bbc92ee7e4d05571e734022894afa2236ccbf9a4':
  adbd: Don't close/reopen FFS ep0 on disconnect
2014-01-28 00:59:16 +00:00
Benoit Goby
6ddabb7a1c Merge "adbd: Don't close/reopen FFS ep0 on disconnect" 2014-01-28 00:07:15 +00:00
Mark Salyzyn
7aa39a7b19 adb: deprecate legacy log service interface
(cherry picked form commit c66a7537df)

Change-Id: If96019cc13b3d7a4dcd7785c7137e0cbcc622981
2014-01-27 15:09:59 -08:00
Mark Salyzyn
c788278abc adb: regression from Move list.c to inlines
(cherry picked from commit 5f64d528be)

Change-Id: I057dbe3db80b1460f774e9f9ade11e0929529ec6
2014-01-27 15:09:22 -08:00
Nick Kralevich
75e0645921 Fix overflow in adb_client
Credit: Joshua Drake
Bug: 12060953

(cherry picked from commit e89e09dd2b)

Change-Id: I8a9b2592a5e4f7527c607abfe4ea6df6eb550aa8
2014-01-27 14:12:34 -08:00
Nick Kralevich
c3af60aff5 am c7e28899: am 16384312: am 0620e3dd: Merge "adbd: switch to su domain when running as root"
* commit 'c7e28899c3917ad6e72d5dc99401bcd133cbd475':
  adbd: switch to su domain when running as root
2014-01-24 18:12:03 +00:00
Nick Kralevich
1638431224 am 0620e3dd: Merge "adbd: switch to su domain when running as root"
* commit '0620e3ddb85582f66612d046d1295dc20bf1a4f5':
  adbd: switch to su domain when running as root
2014-01-24 10:06:46 -08:00
Nick Kralevich
d49aa2537c adbd: switch to su domain when running as root
When adbd runs as root, it should transition into the
su domain. This is needed to run the adbd and shell
domains in enforcing on userdebug / eng devices without
breaking developer workflows.

Introduce a new device_banner command line option.

Change-Id: Ib33c0dd2dd6172035230514ac84fcaed2ecf44d6
2014-01-22 14:20:17 -08:00
Nick Kralevich
eb665350d1 am 55537633: am 78af6c4c: am 0a72d293: Merge "Fix "adb push /sdcard/filename""
* commit '555376331f436fb519c182677c22d8299ead5523':
  Fix "adb push /sdcard/filename"
2014-01-18 01:12:08 +00:00
Nick Kralevich
78af6c4c94 am 0a72d293: Merge "Fix "adb push /sdcard/filename""
* commit '0a72d2930adcd3b3504448f71b25ebb88c2cc3cf':
  Fix "adb push /sdcard/filename"
2014-01-17 17:05:19 -08:00
Nick Kralevich
72917837e6 Fix "adb push /sdcard/filename"
Don't assume that calling chown(filename, getuid(), getgid())
will always succeed. In the case of /sdcard, a file you create
will be owned by root, so the chown call will fail.

Instead, use uid=gid=-1 so that the chown call is truly a no-op.

Ignore the results of calling chmod. Again, for /sdcard, the
chmod call will never succeed, because the file isn't owned by
the shell user.

Bug: 12441485
Change-Id: I11eaf1d6f6049c1158afc29754fbb7af2baf2c78
2014-01-17 16:16:42 -08:00
Elliott Hughes
ec9e5891ac am 8940c0a0: am 97373bbc: am 7cd15614: Merge "system/core 64-bit cleanup."
* commit '8940c0a07f8d6682712e2d2ee387e78096602f99':
  system/core 64-bit cleanup.
2014-01-16 22:11:49 +00:00
Elliott Hughes
97373bbc71 am 7cd15614: Merge "system/core 64-bit cleanup."
* commit '7cd1561410473c71d40cec822fb53a282b5b3279':
  system/core 64-bit cleanup.
2014-01-16 14:05:24 -08:00
Elliott Hughes
ccecf14254 system/core 64-bit cleanup.
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.

Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
2014-01-16 12:54:18 -08:00
Nick Kralevich
225459a5da Remove obsolete vdc call.
Since ca8e66a8b0, init has
been handling reboots and filesystem unmounts. Remove obsolete
call to vdc.

Bug: 12504045
Change-Id: If8704ca042cb3a68857743b9973e48c52e7eb881
2014-01-14 16:38:45 -08:00
Colin Cross
e0e7595f3c am e76343ef: Merge "Emerson USB ID"
* commit 'e76343ef72458aff8fdc25c57f4e84407c05a2f2':
  Emerson USB ID
2014-01-11 23:09:48 -08:00
Colin Cross
e76343ef72 Merge "Emerson USB ID" 2014-01-12 07:05:04 +00:00
Jon Sawyer
6e39bace17 Emerson USB ID
Adds Emerson's USB id to the known USB Devices.

Change-Id: If6115c2551c1f30a5c190690f2aeaaf2adff7ee1
Signed-off-by: Jon Sawyer <jon@cunninglogic.com>
2014-01-11 22:59:18 -08:00
Colin Cross
c121c69b85 am b0751101: Merge "HP USB ID"
* commit 'b0751101b090a8732c62ad261fa44e5d6a69a2cc':
  HP USB ID
2014-01-09 09:59:30 -08:00
Jon Sawyer
5ff167ca11 HP USB ID
Adds HP's USB id to the know USB Devices

Change-Id: I975126f3ae5e53f25e18dea7cc43c29076bfc965
Signed-off-by: Jon Sawyer <jon@cunninglogic.com>
2014-01-08 08:14:26 -08:00
Jack Pham
4cbf1d8822 adbd: Don't close/reopen FFS ep0 on disconnect
In case of bulk read/write failure or disconnect, transport_usb
calls usb_ffs_kick in order to force the daemon to re-open the
FunctionFS ep files as a way to soft restart the kernel driver.

However, there's no reason to always close the ep0 file, as it
would need to be reopened and the descriptors rewritten--this
is unnecessary, especially in the simple/frequent case of cable
disconnect, and causes the kernel driver to unbind and bind *all*
of the function drivers. This is causing USB Chapter 9 tests to fail.

Thus, try to reuse the same ep0 file handle across reconnects. In
case there is a failure, the ep1/ep2 opens would fail and all the
file handles get dropped. For the adb root case, the entire daemon
gets restarted anyway.

Change-Id: I0840085c52a0795dcb2d751c39aa4a436c039ee2
2014-01-07 15:04:09 -08:00
Colin Cross
d8f74f1b3e am 491ecd0b: Merge changes Id8bec8a3,Ied42e4d0,Iea3f7cc6,Ic7f7c984,Ic77d5f71, ...
* commit '491ecd0b7275a98b7fda9b1e807724f7f06b1469':
  adb: Add USB vendor ID for YotaDevices
  adb: Add USB vendor ID for TechFaith
  adb: Add USB vendor ID for Rockchip
  adb: Add USB vendor ID for EMERGING Technology (Holdings) Ltd.
  adb: Add USB vendor ID for Allwinner
  adb: Add USB vendor ID for Amlogic
  added Gigaset's USB vendor ID
  adb: alphabetically sort usb vendors lists
2014-01-06 12:23:30 -08:00
DanielMo
c1b6b153dc adb: Add USB vendor ID for YotaDevices
Change-Id: Id8bec8a35edd0d21ae52e8469f7a65b5f4433bc2
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-01-06 12:16:40 -08:00
DanielMo
402c2b9888 adb: Add USB vendor ID for TechFaith
Change-Id: Ied42e4d011b736ee990ed75e7d81bc6a16db47f9
2014-01-06 12:16:40 -08:00
DanielMo
d0057c006b adb: Add USB vendor ID for Rockchip
Change-Id: Iea3f7cc6ed463684fe30a73c39445b3ca36854d9
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-01-06 12:16:39 -08:00
DanielMo
fdd189c64e adb: Add USB vendor ID for EMERGING Technology (Holdings) Ltd.
Change-Id: Ic7f7c984db19050d2ce4da8ae87683ce42dc9094
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-01-06 12:16:39 -08:00
DanielMo
63f0f5117b adb: Add USB vendor ID for Allwinner
Change-Id: Ic77d5f71c9e329e33cd31fa0854e692ad794a609
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-01-06 12:16:39 -08:00
DanielMo
d5dab6d5f8 adb: Add USB vendor ID for Amlogic
Change-Id: I35fad82214f2b5a82b0150821326aaea15784de1
Signed-off-by: DanielMo <DanielMo@fih-foxconn.com>
2014-01-06 12:16:39 -08:00
Volker Moesker
319d8c1d1f added Gigaset's USB vendor ID
Change-Id: Iebb0f352eec4530ee1e972527fc76bbb9dad5cc3
Signed-off-by: Volker Moesker <volker.moesker@gigaset.com>
2014-01-06 12:16:29 -08:00
Colin Cross
293717c364 adb: alphabetically sort usb vendors lists
Sort the lists of usb vendor ids alphabetically to reduce future
conflicts.

Change-Id: I682c18a1d97adf3a4aa9c00de9fed932c83e4646
2014-01-06 12:12:39 -08:00
Colin Cross
4600d80cef am e1095e1d: Merge "Modify BYD\'s USB Vendor ID"
* commit 'e1095e1da12de9d6dc219f497f7c19d1c1f7a41b':
  Modify BYD's USB Vendor ID
2014-01-03 12:58:31 -08:00
Colin Cross
e1095e1da1 Merge "Modify BYD's USB Vendor ID" 2014-01-03 20:53:22 +00:00
Nick Kralevich
8be1ccff87 am fcf3d207: Merge "adb: configure /system file permission with fs_config"
* commit 'fcf3d207c51f1e734137a08ae2fdb1bb37a50b87':
  adb: configure /system file permission with fs_config
2014-01-03 11:04:02 -08:00
Liang Cheng
20d33f4d99 adb: configure /system file permission with fs_config
adbd changes the permissions of files uploaded by copying
owner's permission to group and other. This causes kernel
load failure if any changes are made to kernel modules
followed by ``adb push'' or ``adb sync'' because file mode
644 would become 666.

The change uses fs_config to get the target mode of files.

In addition, the SELinux file label is set incorrectly
on synced files. Set the label properly.

Change-Id: I354db848f39adfbf189d7e8d3b028e8d763c772f
Signed-off-by: Liang Cheng <licheng@nvidia.com>
Bug: 12264775
2014-01-02 20:26:18 -08:00
Nick Kralevich
98fdcfa981 am 67cb61ee: Merge "adb: Check sender\'s socket id when receiving packets."
* commit '67cb61ee5a8b8f5c967361430fff250e76c3a1dc':
  adb: Check sender's socket id when receiving packets.
2013-12-19 10:38:02 -08:00
David 'Digit' Turner
818d641c42 adb: Check sender's socket id when receiving packets.
handle_packet() in adb.c didn't check that when an A_WRTE packet is
received, the sender's local-id matches the socket's peer id.

This meant that a compromised adbd server could sent packets to
the host adb server, spoofing the identity of another connected
device if it could "guess" the right host socket id.

This patch gets rid of the issue by enforcing even more checks
to ensure that all packets comply with the description in
protocol.txt.

+ Fix a bug where closing a local socket associated with a
  remote one would always send an A_CLSE(0, remote-id, "")
  message, though protocol.txt says that should only happen
  for failed opens.

  The issue was that local_socket_close() called
  remote_socket_close() after clearing the remote socket's
  'peer' field.

  The fix introduces a new asocket optional callback,
  named 'shutdown' that is called before that, and is
  used to send the A_CLSE() message with the right ID
  in remote_socket_shutdown().

  Also add some code in handle_packet() to detect
  invalid close commands.

Change-Id: I9098bc8c6e81f8809334b060e5dca4fc92e6fbc9
2013-12-16 17:58:08 +01:00
Nick Kralevich
a91a47c30c am b2dfa7ec: am 02d90b92: am 33e7f915: am 54a80bcf: am cd072e94: am ba104fb7: am e975716e: am 03d4eb29: am d63fb078: am e89e09dd: Fix overflow in adb_client
* commit 'b2dfa7ece7fb69d2ce5ae517eb35492beb646385':
  Fix overflow in adb_client
2013-12-10 12:42:20 -08:00
Nick Kralevich
b2dfa7ece7 am 02d90b92: am 33e7f915: am 54a80bcf: am cd072e94: am ba104fb7: am e975716e: am 03d4eb29: am d63fb078: am e89e09dd: Fix overflow in adb_client
* commit '02d90b92ce65ad4e7f49565f0e97373e1d8b0fbf':
  Fix overflow in adb_client
2013-12-10 12:39:32 -08:00
Nick Kralevich
02d90b92ce am 33e7f915: am 54a80bcf: am cd072e94: am ba104fb7: am e975716e: am 03d4eb29: am d63fb078: am e89e09dd: Fix overflow in adb_client
* commit '33e7f915d6a27880dd4c4c0709dcc921f549eea2':
  Fix overflow in adb_client
2013-12-10 12:37:32 -08:00
Nick Kralevich
33e7f915d6 am 54a80bcf: am cd072e94: am ba104fb7: am e975716e: am 03d4eb29: am d63fb078: am e89e09dd: Fix overflow in adb_client
* commit '54a80bcf88060b21f527c631c7ec911171bdb13f':
  Fix overflow in adb_client
2013-12-10 12:31:17 -08:00
Nick Kralevich
54a80bcf88 am cd072e94: am ba104fb7: am e975716e: am 03d4eb29: am d63fb078: am e89e09dd: Fix overflow in adb_client
* commit 'cd072e94cf7e546cd6d333cd65641edcd69402b7':
  Fix overflow in adb_client
2013-12-10 12:29:05 -08:00
Nick Kralevich
03d4eb2900 am d63fb078: am e89e09dd: Fix overflow in adb_client
* commit 'd63fb078aea697c536b19c03d29d4dde4ac087fc':
  Fix overflow in adb_client
2013-12-10 12:17:45 -08:00
Nick Kralevich
d63fb078ae am e89e09dd: Fix overflow in adb_client
* commit 'e89e09dd2b9b42184973e3ade291186a2737bced':
  Fix overflow in adb_client
2013-12-10 12:14:44 -08:00
Nick Kralevich
e89e09dd2b Fix overflow in adb_client
Change-Id: I7f8582bd8a69d61ce47d11a9ffd0e901fc371037
Credit: Joshua Drake
Bug: 12060953
2013-12-10 10:18:10 -08:00
Wenhao Li
a09558c2e2 Make server port option work on windows
The server port command line option do not work
on windows, need pass -P option to child process.

Change-Id: Ibb3f0a926fae8e17c75fccbd4bb3a33318fffe9e
2013-11-13 19:04:25 +08:00
Elliott Hughes
9259663cdb am f17f5591: am 36d44740: Merge "Fix a bunch of small system/core bugs."
* commit 'f17f55914e18eb176ccc5bb8266b248ece8cb56b':
  Fix a bunch of small system/core bugs.
2013-10-29 18:31:01 -07:00
Elliott Hughes
14e28d39f7 Fix a bunch of small system/core bugs.
Missing frees in:
  adb/file_sync_client.c
  fastboot/fastboot.c
  libsparse/output_file.c

Missing closedirs in:
  adb/file_sync_service.c
  cpio/mkbootfs.c
  libcutils/dir_hash.c

Potential buffer overrun in:
  gpttool/gpttool.c

Incorrect NULL check in:
  libsparse/backed_block.c

Bug: https://code.google.com/p/android/issues/detail?id=61564
Change-Id: If97838a9e73a77aef7f416c31c237ce1fca4ce21
2013-10-29 14:12:46 -07:00
Brian Carlstrom
406abdc8a2 am 5dadac50: am 87af04a4: Merge "Improve some adb error logging"
* commit '5dadac50c4bbeaf8baf4d5e04c2d2706d9e74fc7':
  Improve some adb error logging
2013-10-28 14:30:26 -07:00
Brian Carlstrom
93c91fad77 Improve some adb error logging
Bug: 11290643
Change-Id: Ibad4e9f0b69421cd6017b70a52237e7f27aab848
2013-10-27 16:56:55 -07:00
Nick Kralevich
0bf7924df1 am 91704522: Don\'t return immediately from reboot commands.
* commit '917045222a69021eb36aea96708649c709685509':
  Don't return immediately from reboot commands.
2013-10-24 12:39:29 -07:00
Nick Kralevich
917045222a Don't return immediately from reboot commands.
The reboot commands return too fast, interfering with testing.
Add a pause(), which will allow the device time to complete the
reboot.

Change-Id: Ie9cc6eea67b7ff662ec71ea2329cbb94f8d55404
Bug: 11369303
2013-10-24 11:01:16 -07:00
Colin Cross
903e6865ca am b024bbf6: am 6da66ef4: Merge "Handle screendumps for all framebuffer sizes"
* commit 'b024bbf6a1daf752a8d756bfda472fe6fb48dd9e':
  Handle screendumps for all framebuffer sizes
2013-10-02 14:31:46 -07:00
Colin Cross
6da66ef49b Merge "Handle screendumps for all framebuffer sizes" 2013-10-02 20:24:46 +00:00
Doug Zongker
8e5b63d045 mincrypt: support SHA-256 hash algorithm
- adds a library to compute the SHA-256 hash

- updates the RSA verifier to take an argument specifying either SHA-1
  or SHA-256

- updates DumpPublicKey to with new "key" version numbers for
  specifying SHA-256

- adds new argument to adb auth code to maintain existing behavior

(cherry picked from commit 515e1639ef)

Change-Id: Ib35643b3d864742e817ac6e725499b451e45afcf
2013-09-25 09:26:34 -07:00
Chris Dearman
85373f4280 Handle screendumps for all framebuffer sizes
readx() treats a partial read as an error but also consumes the data,
Now exactly the amount of data needed for the screendump is requested.

This bug showed up for framebuffers that were not a multiple of 640
bytes.

Also fix a compiler warning related to handing pipe() failure.

Change-Id: I8b1713923e156d4e3424784152e5dc5cbc7d478d
2013-09-25 02:43:45 -07:00
Elliott Hughes
b926493417 am 876f4366: am a7f6e015: Merge "correct msi usb vendor id."
* commit '876f436668036e8e9d3f86434eee1a44ff5364b8':
  correct msi usb vendor id.
2013-08-28 08:37:02 -07:00
astonehuang
48c5d7b6cd correct msi usb vendor id.
Change-Id: I13128531b8dd7758abddce47ce1c119381773c26
2013-08-28 10:53:17 +08:00
Elliott Hughes
88ea2f669f am 3042c265: am b3644d8f: Merge "Add USB Vendor ID for WACOM"
* commit '3042c265bf3123426e99fed856c9d3b7fa3b3ad6':
  Add USB Vendor ID for WACOM
2013-08-16 15:37:43 -07:00
Wing Tseng
64a602942e Add USB Vendor ID for WACOM
Change-Id: I3deee6d5bdfb9c5bbc0fddcfa39814d27ee281c2
Signed-off-by: Wing Tseng <Wing_Tseng@pegatroncorp.com>
2013-08-15 09:33:59 +08:00
Elliott Hughes
49f2e1cedf am cc39d421: am 936032b4: Merge "Add USB Vendor ID for MSI"
* commit 'cc39d421ea5f449d5e201dd1ada7b2a12acf5ad9':
  Add USB Vendor ID for MSI
2013-08-12 10:34:58 -07:00
astonehuang
307d96a6e6 Add USB Vendor ID for MSI
Change-Id: I4f4bfb6ef08058bf749917119a2b08952e7bc337
2013-08-01 15:23:17 +08:00
Colin Cross
44f5c15724 Merge "Move liblog headers to system/core/include/log" 2013-07-25 21:39:24 +00:00
Elliott Hughes
b815810f47 am 09f240e0: am 5d855432: Merge "Add USB Vendor ID for ECS"
* commit '09f240e0b06326531e64e9826859a774cd456ad7':
  Add USB Vendor ID for ECS
2013-07-25 09:58:12 -07:00
Elliott Hughes
5d8554323c Merge "Add USB Vendor ID for ECS" 2013-07-25 16:50:39 +00:00
Colin Cross
9227bd3855 Move liblog headers to system/core/include/log
Move the liblog headers to log/ instead of cutils/ to complete
the separation of libcutils and liblog.  cutils/log.h still
exists and includes log/log.h in order to support the many existing
modules that use cutils/log.h.

Change-Id: I2758c9f4aedcb809ca7ba8383d0f55041dd44345
2013-07-24 12:32:39 -07:00
ecsgms
cae8b9df5c Add USB Vendor ID for ECS
Change-Id: Ib2fa70204d37f53dc642091eb927d865ddc585b5
2013-07-24 16:13:49 +08:00
Elliott Hughes
228ee639be am 98c02528: am 19188955: am d92e35eb: Merge "Add Qisda usb config"
* commit '98c02528a2f8bdc0f31a78a8b0b086f4ae823310':
  Add Qisda usb config
2013-06-18 11:37:47 -07:00
Elliott Hughes
19188955b5 am d92e35eb: Merge "Add Qisda usb config"
* commit 'd92e35eb7b97f349054390cfee1d40154dba6d66':
  Add Qisda usb config
2013-06-18 11:32:58 -07:00
esther
001fe87e02 Add Qisda usb config
add Qisda usb config
Signed-off-by: esther <esther530@gmail.com>

Change-Id: I5b8a0e5bd2218ecdf417de357c9a7d9307c91932

Conflicts:
	adb/usb_vendors.c
2013-06-18 11:28:08 -07:00
Elliott Hughes
e39057b687 am 88411498: am 520f4f06: am 865bb05d: Merge "adb: fix reported transfer size for transfer over 4 GiB"
* commit '88411498b3341dbf8f2976991524b1e21dedc6f6':
  adb: fix reported transfer size for transfer over 4 GiB
2013-06-17 14:00:17 -07:00
Elliott Hughes
8df29c9b61 am 1aeefcd6: am 0173ebd5: am 5f8d9c01: Merge "adb: add vendor ID\'s for Nook, Haier, Hisense, and MTK"
* commit '1aeefcd6900d85911028e6d3e344e338e0a05158':
  adb: add vendor ID's for Nook, Haier, Hisense, and MTK
2013-06-17 13:56:54 -07:00
Elliott Hughes
520f4f0603 am 865bb05d: Merge "adb: fix reported transfer size for transfer over 4 GiB"
* commit '865bb05dd0db1531f252de5e137605beec171ca2':
  adb: fix reported transfer size for transfer over 4 GiB
2013-06-17 13:56:04 -07:00
Elliott Hughes
0173ebd531 am 5f8d9c01: Merge "adb: add vendor ID\'s for Nook, Haier, Hisense, and MTK"
* commit '5f8d9c012cf28fad57d0896b938b05e2c976073f':
  adb: add vendor ID's for Nook, Haier, Hisense, and MTK
2013-06-17 13:51:46 -07:00
Elliott Hughes
865bb05dd0 Merge "adb: fix reported transfer size for transfer over 4 GiB" 2013-06-17 20:49:25 +00:00
Jeff Smith
71150ce4ef adb: add vendor ID's for Nook, Haier, Hisense, and MTK
Change-Id: I156ff750ef9ae66113d1e0e3ceffea047abc03b9
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
2013-06-17 13:21:04 -05:00
Jeff Smith
d9a1430ff2 adb: fix reported transfer size for transfer over 4 GiB
When transferring files over 4 GiB with adb, the size of the transfer
is misreported.

Change-Id: Ia3d4cae1e9f82b4f7432341820b101ea9a44f85b
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
2013-06-15 16:03:54 -05:00
Nick Kralevich
893a4a47e8 adb: Only use properties on device builds
When building for the host, don't make reference to
property_get / property_set.  I'm in the process of removing
host side support for properties.

Change-Id: I691c5872b5fd538e78bc38a3fe72574cdc7f43c3
2013-05-23 10:37:46 -07:00
kongfanqing
cabb75e427 Modify BYD's USB Vendor ID
Change-Id: I391487a12ba7ed86aac81457f8026acd3fd7576c
2013-05-15 14:17:41 +08:00
Kenny Root
928116ceef Host builds: add fastboot and adb
Add fastboot and adb host utilities to debug builds for debugging
and development purposes.

Change-Id: If77699a27497b8641998930f14d4ee418b856080
2013-05-02 09:51:53 -07:00
Benoit Goby
15e84ad042 Merge "adb: Handle adb connect in a thread" 2013-04-25 22:43:54 +00:00
Nick Kralevich
44a5fb5704 Merge "fs_mgr: make block devices read-only" 2013-04-25 20:22:20 +00:00
Benoit Goby
1c45ee92e2 adb: Handle adb connect in a thread
adb connect calls connect() in the event loop. If you pass a wrong ip
address or the server is slow to respond, this will block the event loop
and you can't even kill the adb server with adb kill-server. Handle connect
requests in a service thread instead.

Change-Id: I2ee732869a3dc22a6d3b87cf8ac80acaa7790037
2013-04-25 12:34:49 -07:00
Benoit Goby
9470c2f1ab adb: Cleanup dead code
dns_service is unused and recover_service has been replaced by adb
sideload

Change-Id: Ie90000d7f672e8299ee1622a9690c7371b214dc1
2013-04-24 21:31:45 -07:00
Nick Kralevich
e18c0d508a fs_mgr: make block devices read-only
When a filesystem is mounted read-only, make the underlying
block device read-only too. This helps prevent an attacker
who is able to change permissions on the files in /dev
(for example, symlink attack) from modifying the block device.

In particular, this change would have stopped the LG Thrill / Optimus
3D rooting exploit
(http://vulnfactory.org/blog/2012/02/26/rooting-the-lg-thrill-optimus-3d/)
as that exploit modified the raw block device corresponding to /system.

This change also makes UID=0 less powerful. Block devices cannot
be made writable again without CAP_SYS_ADMIN, so an escalation
to UID=0 by itself doesn't give full root access.

adb/mount: Prior to mounting something read-write, remove the
read-only restrictions on the underlying block device. This avoids
messing up developer workflows.

Change-Id: I135098a8fe06f327336f045aab0d48ed9de33807
2013-04-24 08:53:26 -07:00
Nick Kralevich
ca8e66a8b0 Make init handle reboots
Move the responsibility for rebooting the system from the
reboot command to init. Init is in a better position to take
actions to bring the system down cleanly, including making sure
filesystems are mounted read-only.

The only UIDs which can perform an init triggered reboot are
root, system, and shell.

Modify the reboot command so that it calls into init to perform
the reboot. The reboot command no longer requires CAP_SYS_BOOT.

Remove the -n reboot option and code which supports it.  Anyone needing
to do an unclean shutdown can just do a 'echo c > /proc/sysrq-trigger'.

Modify adb so that it calls into init to perform a shutdown.

Bug: 8646621
Change-Id: I84c0513acb549720cb0e8c9fcbda0050f5c396f5
2013-04-23 13:21:40 -07:00
Colin Cross
5192363226 am b544da0b: am d7cab8bf: Merge "adb : add missing connection states"
* commit 'b544da0be42cdd1e28d6562a26215d57c51b2f2b':
  adb : add missing connection states
2013-04-17 15:13:27 -07:00
Colin Cross
b544da0be4 am d7cab8bf: Merge "adb : add missing connection states"
* commit 'd7cab8bff1334ba48620a16d1b98f2ae623fee7d':
  adb : add missing connection states
2013-04-17 15:11:39 -07:00
Colin Cross
d7cab8bff1 Merge "adb : add missing connection states" 2013-04-17 21:45:45 +00:00
Elliott Hughes
50970341bf am ac76c1f1: am ffc5a4a5: Merge "Add OUYA VID to known VID list"
* commit 'ac76c1f16f889140ec5c56faccd676c2ff15d7bc':
  Add OUYA VID to known VID list
2013-04-17 09:30:59 -07:00
Elliott Hughes
ac76c1f16f am ffc5a4a5: Merge "Add OUYA VID to known VID list"
* commit 'ffc5a4a529338c834954e58de2701572eb0752f0':
  Add OUYA VID to known VID list
2013-04-17 09:27:37 -07:00
Al Sutton
21ec0516cf Add OUYA VID to known VID list
Add the OUYA VID to the list of known USB VIDs to allow developers with OUYA
consoles to have their device automatically recognized.

Change-Id: I499114d8071747b972c24681fc0771f000ad9f9d
2013-04-17 09:20:05 -07:00
trevd
a5ad539cff adb : add missing connection states
Both CS_RECOVERY and CS_SIDELOAD where not being checked by
connection_state_name which resulted in adb get-state returning
unknown when a device is in those modes.

Change-Id: I00716024d6a0bdb68d6e2380c8cd7b5d056bd15f
Signed-off-by: trevd <trevd1234@gmail.com>
2013-04-17 14:34:23 +01:00
Doug Zongker
515e1639ef mincrypt: support SHA-256 hash algorithm
- adds a library to compute the SHA-256 hash

- updates the RSA verifier to take an argument specifying either SHA-1
  or SHA-256

- updates DumpPublicKey to with new "key" version numbers for
  specifying SHA-256

- adds new argument to adb auth code to maintain existing behavior

Change-Id: I5b1406cf57c2b8993f6032eda3e29139f7740839
2013-04-10 14:33:31 -07:00
Benoit Goby
05d6a649a3 am 9f25178a: am 7f8fb3ff: Merge "adb: Prevent registering usb_disconnect twice" into jb-mr2-dev
* commit '9f25178a9dd0aa8fab5e74f785c9997ae230a325':
  adb: Prevent registering usb_disconnect twice
2013-04-02 11:03:18 -07:00
Benoit Goby
9f25178a9d am 7f8fb3ff: Merge "adb: Prevent registering usb_disconnect twice" into jb-mr2-dev
* commit '7f8fb3ffa2a234b704fc975fc9b1001f17df9cac':
  adb: Prevent registering usb_disconnect twice
2013-04-02 08:24:36 -07:00
Benoit Goby
b66356cab6 adb: Prevent registering usb_disconnect twice
adbd can receive multiple AUTH_RSAPUBLICKEY packets. This happens for
example when booting with usb attached when we retry authenticating
after the framework is done booting. Make sure usb_disconnect is only
registered once, otherwise this creates a loop in the disconnects list.

Bug: 8504991
Change-Id: Ia1f9a37005dd17b7eefee1493d622e1679263eea
2013-04-01 17:39:06 -07:00
Colin Cross
b2ba42a5d3 am b1d20464: am f5562cb6: Merge "adb: Remove execute permission on usb_vendor.c"
* commit 'b1d204648eb8061aa59bed189ce41938fa40197a':
  adb: Remove execute permission on usb_vendor.c
2013-03-29 17:58:46 -07:00
Colin Cross
b1d204648e am f5562cb6: Merge "adb: Remove execute permission on usb_vendor.c"
* commit 'f5562cb66c1c15d65bc372ede4c180430e1ce9d7':
  adb: Remove execute permission on usb_vendor.c
2013-03-29 17:13:45 -07:00
Benoit Goby
243667a98e am 78420edc: resolved conflicts for merge of 35200422 to jb-mr2-dev-plus-aosp
* commit '78420edc0f3e99684c36f0d516744b4d9312a1c1':
  Add BYD's USB Vendor ID
  Add USB Vendor ID for Xiaomi
  Add vendor IDs to adb
2013-03-29 16:43:13 -07:00
Benoit Goby
f8cfa8a1e4 adb: Remove execute permission on usb_vendor.c
Change-Id: Ia4f2e0171634764bde3593593b3c99184236528f
2013-03-29 16:33:02 -07:00
Benoit Goby
78420edc0f resolved conflicts for merge of 35200422 to jb-mr2-dev-plus-aosp
Change-Id: I754b8b17a7e3a6e4ef3ccf0a02beca0fc72ba749
2013-03-29 16:29:22 -07:00
sunxiaoqi
92eb583833 Add BYD's USB Vendor ID
Change-Id: I0694ed72d70638f0a4a252b1c802ae8f4e33385e
2013-03-29 14:57:44 -07:00
Gary Hua
d3b69404a1 Add USB Vendor ID for Xiaomi
Change-Id: I9f0622e05334a5074604bd88093172654b4c3e7d
Signed-off-by: Gary Hua <huachengping@xiaomi.com>
2013-03-29 14:56:53 -07:00
Sam Lin
df6d7666fd Add vendor IDs to adb
Adding vendor IDs to adb for device partners:
  AnyDATA, Harris & Oppo

Change-Id: Ib8c5196c53599bd6eb077871cd95ccac935c42e7
2013-03-29 14:51:15 -07:00
Benoit Goby
c6d7e200ed toolbox: Make reboot a separate command from toolbox
Set the CAP_SYS_BOOT filesystem capability on the new reboot
command and keep CAP_SYS_BOOT in adb bounding set so that the
shell user can run it.

Change-Id: I1dd6143445ee2a952254f0452ab6e544318431dd
2013-03-26 12:24:10 -07:00
Sam Lin
644b6afdac Add vendor IDs to adb
Adding vendor IDs to adb for device partners:
  AnyDATA, Harris & Oppo

Change-Id: Ib8c5196c53599bd6eb077871cd95ccac935c42e7
2013-03-12 20:19:53 +08:00
Elliott Hughes
dd0d0e78af am 822ea9b3: am fd5c6b9f: Merge "Close adb_usb.ini after reading it"
* commit '822ea9b3d1cf240b16135e1b5c3bd926c02d17d6':
  Close adb_usb.ini after reading it
2013-03-08 18:32:02 -08:00
Elliott Hughes
fd5c6b9f13 Merge "Close adb_usb.ini after reading it" 2013-03-09 01:20:08 +00:00
Christopher Tate
0c06eb5017 DO NOT MERGE - Document new -obb flag for adb backup
Now that adb backup handles OBB file backup/restore.

(Cherrypicked)

Change-Id: Ie92b546e3898b62d74f552ab577b7756ad176ee6
2013-03-08 15:09:51 -08:00
Colin Cross
95b087fa90 am 79d4381a: am 69f3ec84: Merge "Fix issues where the filename is referred to as \'sideload\'"
* commit '79d4381a8e838d7ddbeda5b7dc90e0c5bca5a8c6':
  Fix issues where the filename is referred to as 'sideload'
2013-03-05 18:52:29 +00:00
Magnus Eriksson
86ae6d587b Fix issues where the filename is referred to as 'sideload'
The adb sideload utility referes to the filename as 'sideload' in some
places. This patch changes the printouts to display the filename instead.

Change-Id: I38ada01a08bed53a8d9697c03f55ce8cee2abe12
Signed-off-by: Magnus Eriksson <eriksson.mag@gmail.com>
2013-03-05 07:37:32 +01:00
Nick Kralevich
277626e59d am 844306bd: am cc4499b6: Merge "adb: use correct header file."
* commit '844306bd9cb3c8b3e514e5d91e9514556e8f95f4':
  adb: use correct header file.
2013-02-28 23:22:04 +00:00
Nick Kralevich
e2864bf727 adb: use correct header file.
Change-Id: I7a66ced762dc077247fd7c2714ae8850ffdcaeb9
2013-02-28 14:12:58 -08:00
Nick Kralevich
4c609e9683 Remove CAP_NET_RAW from adb
ping no longer needs CAP_NET_RAW. See:

* http://lwn.net/Articles/443051/
* https://android-review.googlesource.com/52090
* https://android-review.googlesource.com/52072

Eliminate the CAP_NET_RAW special case in adb

Change-Id: If9d32c5254291b123b06bededc94b64113f6b8f2
2013-02-27 13:15:02 -08:00
Benoit Goby
1531c966c1 Merge "adb: Fix secure adb when booting with usb attached" 2013-02-21 23:55:57 +00:00
Nick Kralevich
080427e4e2 adb: drop capability bounding set on user builds
run-as: don't require CAP_DAC_OVERRIDE.

Prevent an adb spawned application from acquiring capabilities
other than

* CAP_NET_RAW
* CAP_SETUID
* CAP_SETGID

The only privileged programs accessible on user builds are
* /system/bin/ping
* /system/bin/run-as

and the capabilities above are sufficient to cover those
two programs.

If the kernel doesn't support file capabilities, we ignore
a prctl(PR_CAPBSET_DROP) failure. In a future CL, this could
become a fatal error.

Change-Id: I45a56712bfda35b5ad9378dde9e04ab062fe691a
2013-02-15 21:22:19 -08:00
Nick Kralevich
b9c087031b am e149855a: am 523a2090: Merge "adb: Use 64 bit capabilities."
* commit 'e149855a816c98149a95725139ae66f193049ddd':
  adb: Use 64 bit capabilities.
2013-02-15 10:22:08 -08:00
Nick Kralevich
109f4e16cb adb: Use 64 bit capabilities.
Fix the following kernel warning:

$ adb shell dmesg | grep adb
<6>[    7.813003] warning: `adbd' uses 32-bit capabilities (legacy support in use)

Change-Id: I3912302c5c577f1cb03f0c591834ab7b3a72ddf5
2013-02-15 09:33:13 -08:00
Benoit Goby
045a4a9c3a adb: Fix secure adb when booting with usb attached
When booting with usb attached, the secure adb authentication happens
long before the framework is done booting, so adb can't notify the
framework to install the public key.

Change-Id: Id2af6cebece345022f56cb0c4b5af24e1d7a425c
2013-02-02 01:19:06 +00:00
Kenny Root
49f0f77693 am 282caf3b: am 260f3471: am f8afaebe: Merge "Windows adb: include stdint.h for uint8_t on MinGW-w64"
# By Ray Donnelly
# Via Android Git Automerger (2) and others
* commit '282caf3bd0dfd81b92ac74e0b3ea970d195fee7b':
  Windows adb: include stdint.h for uint8_t on MinGW-w64
2013-01-29 21:54:00 -08:00
Kenny Root
53e5b24231 am 6c3d3ccf: am d033739d: am d40fd86e: Merge "Windows adb: initialize on to 1 in disable_tcp_nagle"
# By Ray Donnelly
# Via Android Git Automerger (2) and others
* commit '6c3d3ccfa5d1d77b80e5c7619909a48b976c69ec':
  Windows adb: initialize on to 1 in disable_tcp_nagle
2013-01-29 21:53:59 -08:00
Kenny Root
f8afaebec3 Merge "Windows adb: include stdint.h for uint8_t on MinGW-w64" 2013-01-30 05:44:17 +00:00
Kenny Root
d40fd86ec5 Merge "Windows adb: initialize on to 1 in disable_tcp_nagle" 2013-01-30 05:43:33 +00:00
Benoit Goby
8e85644aa1 Merge "adb: Add "unauthorized" connection state" 2013-01-29 00:17:43 +00:00
Benoit Goby
83dee8e4e5 Merge "adb: Read secure adb keys on every auth request" 2013-01-28 23:33:28 +00:00
David Turner
5bf8a4200c am 3dbcb6d6: am 98d07897: Merge "Windows adb: Make client stdout and stderr handles uninheritable"
* commit '3dbcb6d6c6befc406e4ce4e2b7aa9ad2635dfbb8':
  Windows adb: Make client stdout and stderr handles uninheritable
2013-01-21 02:56:36 -08:00
David Turner
98d0789772 Merge "Windows adb: Make client stdout and stderr handles uninheritable" 2013-01-21 10:16:54 +00:00
Benoit Goby
77e8e5851d adb: Add "unauthorized" connection state
Add a new connection state, so that devices, that require confirmation
to allow adb, appear as "unauthorized" in the adb devices lists.

Change-Id: Ib4264bc5736dedecf05bcf8e31896f4d7a91fad8
2013-01-15 17:21:13 -08:00
Benoit Goby
345cb066d2 adb: Read secure adb keys on every auth request
The framework can now clear the user key list, so we need to reload the
key list on every auth request instead of loading it once when adbd
starts.
This also fixes issues with encrypted devices, where the user key file
is only readable after the user has unlocked the device.

Change-Id: I350c5aab986f8ca86b95f316398d03012553e581
2013-01-15 17:16:22 -08:00
Ray Donnelly
bbe26c1f79 Windows adb: initialize on to 1 in disable_tcp_nagle 2013-01-11 16:36:00 +00:00
Ying Wang
2c43b55814 resolved conflicts for merge of f62f1e3a to master
Change-Id: I35c66859e2c454c20c8acc6b2b1f0833032205bb
2013-01-10 15:35:05 -08:00
JP Abgrall
571c136768 adb: HACK: (linux only) allow temp mitigation for multithreaded issues
There are serious multithreading issues between the fdevent and transport
subsystems which both manipulate struct asocket and struct fde concurrently.
The prevalent symptom being around multiple socket closures which stomp
 on each other, typically causing:
   "glibc detected *** adb: double free or corruption ..."

This HACK allows forcing CPU affinity via an env var. E.g.:
  export ADB_CPU_AFFINITY_BUG6558362=0
which will cause ONLY the adb server and all its threads to be pegged
to CPU 0.

The result is visible in valgrind's helgrind: no *socket_close() related
data races. But tons of other races are still there.

Bug: 6558362
Change-Id: I0f112390a6a921c64b2a783297be9e99ce27fd56
2013-01-09 15:34:21 -08:00
Ray Donnelly
cbb9891049 Windows adb: include stdint.h for uint8_t on MinGW-w64
Change-Id: I84b8284bc034feb0acd313b0aad9e2fa5868854f
2013-01-08 23:11:49 +00:00
Ray Donnelly
267aa8b00e Windows adb: Make client stdout and stderr handles uninheritable
Change-Id: Ib0519a199c9504aad1d0ecc3757f4d162984bf22
2013-01-08 23:02:28 +00:00
Ying Wang
ef2ea99bfe Merge "Correct LOCAL_LDLIBS of adb" 2013-01-08 13:56:07 -08:00
jp abgrall
d7c52a458e am 03873ce4: am 77eccafe: Merge "Support adb client connect to remote server"
* commit '03873ce495e8c4bdb1289cdfa2b97cb47bb15108':
  Support adb client connect to remote server
2013-01-04 12:08:28 -08:00
Matt Gumbel
d7b3308511 Support adb client connect to remote server
ADB client: allow user to specify hostname and port number of remote
adb server.
ADB server: bind server to all network interfaces instead of just
localhost when user gives -a flag.

Primary use-case for this change is to support remote testing of USB
devices. HostA is running some test automation software which invokes adb
client. HostB has USB-only device attached and is running adb server. adb
client on HostA makes connection to adb server on HostB to talk to the
USB device.

Change-Id: I845cc8c00350b400317f8c18f813e6fd79bd5470
Signed-off-by: Dean Kwon <daex.i.kwon@intel.com>
Signed-off-by: Jim Bride <jim.bride@intel.com>
Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
2013-01-04 11:00:38 -08:00
Chih-Wei Huang
9c60755207 Correct LOCAL_LDLIBS of adb
adb doesn't really use ncurses-libs, remove it.

Add -ldl for the symbols dlclose, dlerror, dlopen...
introduced from dso_dlfcn.c of libcrypto_static.a.

Change-Id: If1cc23987a9b35ec535bbf8f4e7db141b9f10af7
2013-01-01 15:57:40 +08:00
David 'Digit' Turner
9bc6f20c61 am abf7cc97: am 13306d95: Merge "adb: Improve ADB\'s forward redirection management."
* commit 'abf7cc977e41540c45836d2fafd81606117f0399':
  adb: Improve ADB's forward redirection management.
2012-12-13 18:25:53 -08:00
David 'Digit' Turner
0d82fbf04d adb: Improve ADB's forward redirection management.
This adds a few new options/modes to 'adb forward':

  adb forward --list
  adb forward --remove <local>
  adb forward --remove-all
  adb forward --no-rebind <local> <remote>

For more context, see http://code.google.com/p/android/issues/detail?id=39631

Note that this only affects the host adb client and server programs,
i.e. it's compatible with devices running older adbd versions.

Change-Id: I9cda3ba12b5a8560a2061620bc7f948e5c1e70f7
2012-11-26 21:37:08 +01:00
Chris Dearman
60529e39bb Close adb_usb.ini after reading it
Signed-off-by: Chris Dearman <chris@mips.com>
Change-Id: I7d3ee8cbd54af206dac89225c438e6c7322c571f
2012-11-16 14:58:26 -08:00
Xavier Ducrohet
846c686b66 am 493d04d2: am f621d62a: am c4244565: am d1e39491: Add usb vendor id for Teleepoch.
* commit '493d04d2fec59b273a067f5ef9d908dd0b441a08':
  Add usb vendor id for Teleepoch.
2012-11-08 06:21:12 -08:00
Xavier Ducrohet
493d04d2fe am f621d62a: am c4244565: am d1e39491: Add usb vendor id for Teleepoch.
* commit 'f621d62adcbcd81d6479223d9afe47c1d966710d':
  Add usb vendor id for Teleepoch.
2012-11-08 06:14:18 -08:00
Xavier Ducrohet
d1e39491f0 Add usb vendor id for Teleepoch.
Change-Id: I82bbfed598fc3a886681c4139600cf487034c59c
2012-11-06 12:56:14 -08:00
Kenny Root
1dcaf9d054 am 51ccef27: Merge "Add TEMP_FAILURE_RETRY macro for darwin"
* commit '51ccef27cab58277775e62518a59666d2a059b62':
  Add TEMP_FAILURE_RETRY macro for darwin
2012-10-13 13:54:34 -07:00
Kenny Root
89c2812bd6 Add TEMP_FAILURE_RETRY macro for darwin
Darwin doesn't define the TEMP_FAILURE_RETRY macro in unistd.h so we
need to add it everywhere. Joy!

(cherry picked from commit ec90f1dc11)

Change-Id: Ida554fc65193672cc4616dec79e6282e06cc1b28
2012-10-13 12:35:03 -07:00
Kenny Root
ec90f1dc11 Add TEMP_FAILURE_RETRY macro for darwin
Darwin doesn't define the TEMP_FAILURE_RETRY macro in unistd.h so we
need to add it everywhere. Joy!

Change-Id: Ida554fc65193672cc4616dec79e6282e06cc1b28
2012-10-13 12:33:11 -07:00
Kenny Root
c5333e494d am 1dc92bac: am 207c17ff: Merge "Make adb robust against EINTR"
* commit '1dc92bacb8cbf052438e0b1af4030a57901d6e94':
  Make adb robust against EINTR
2012-10-13 00:01:37 -07:00