History log of /system/core/adb/usb_linux_client.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
57de0514f0aeabe092ce3a122402721c93a70a2c 26-May-2016 Siqi Lin <siqilin@google.com> Revert "adb: close ep0 on disconnection."

This reverts commit 69e97e4bee9ee43ef55d1bb205bc4ca065d089bc.

Bug: 28932120
Change-Id: I5e2569abed316c089886556c432bfe59bca08549
/system/core/adb/usb_linux_client.cpp
69e97e4bee9ee43ef55d1bb205bc4ca065d089bc 27-Apr-2016 Yabin Cui <yabinc@google.com> adb: close ep0 on disconnection.

adbd on device kicks the usb connection when usb IO fails. But to notify
adb on host to reconnect it, adbd needs to close ep0 to reset the usb
connection. Otherwise, adb on host cann't connect the device unless the
usb cable is reconnected or adb host server is restarted.

This can be tested by using `adb reconnect device` command.

Bug: 25935458

Change-Id: I80979d6029e60b9cfd218f7b9b5201810238ec07
/system/core/adb/usb_linux_client.cpp
9b53e4c42c595390dc0fa68a5340e0dfe59dd279 05-Apr-2016 Yabin Cui <yabinc@google.com> adb: fix adb usb operations on device.

Problem: For devices using /dev/usb-ffs/adb, Run
`while true; do adb reconnect device; sleep 1; done`. And the
device soon becomes offline. The adbd log shows that calling
adb_read(h->bulk_out) in usb_ffs_read() gets EOVERFLOW error.

Reason: When kicking a transport using usb-ffs, /dev/usb-ffs/adb/ep0
is not closed, and the device will not notify a usb connection reset
to host. So the host will continue to send unfinished packets even
if a new transport is started on device. The unfinished packets may
not have the same size as what is expected on device, so adbd on
device gets EOVERFLOW error. At the worst case, adbd has to create new
transports for each unfinished packet.

Fixes:
The direct fix is to make the usb connection reset when kicking transports,
as in https://android-review.googlesource.com/#/c/211267/1. And I think
we can make following improvements beside that.
1. Close a file that is used in other threads isn't safe. Because the file
descriptor may be reused to open other files, and other threads may operate
on the wrong file. So use dup2(dummy_fd) to replace close() in kick function,
and really close the file descriptor after the read/write threads exit.

2. Open new usb connection after usb_close() instead of after
usb_kick(). After usb_kick(), the transport may still exist and
reader/writer for the transport may be still running. But after
usb_close(), the previous transport is guaranteed to be destroyed.

Bug: 25935458
Change-Id: I1eff99662d1bf1cba66af7e7142f4c0c4d82c01b
(cherry picked from commit 005bf1e05be5de518184c376ebf88268bb191d09)
/system/core/adb/usb_linux_client.cpp
d9db09c3158d3da6aad34fbb926888ceafab3a55 12-Feb-2016 Josh Gao <jmgao@google.com> adb: make adb_thread_func_t return void, add adb_thread_exit.

Windows restricts the return value of threads to 32-bits, even on 64-bit
platforms. Since we don't actually return meaningful values from thread,
resolve this inconsistency with POSIX by making adb's thread abstraction
only take void functions.

Change-Id: I5c23b4432314f13bf16d606fd5e6b6b7b6ef98b5
(cherry picked from commit b5fea14e13bb6e41b36f374c954dc55faeef4627)
/system/core/adb/usb_linux_client.cpp
ae72b5aa4bf079aa1c5edc0d0f9b91831d4ecfbb 17-Dec-2015 Josh Gao <jmgao@google.com> adb: extract USB FFS read/write limit constants.

Change-Id: I5e9fb7959a1c4744cb8d53ece4634138239d4e49
/system/core/adb/usb_linux_client.cpp
0b19540dee9d0eee56f87705eea771b13800290f 16-Dec-2015 Josh Gao <jmgao@google.com> adb: split up reads longer than 16k.

Reads from functionfs allocate contiguous buffers in the kernel, causing
long ones to sometimes fail because of memory fragmentation.

Bug: http://b/26206622
Change-Id: Id40753d6f29b37b5ca97c3e2fa3921f52b4242de
/system/core/adb/usb_linux_client.cpp
1b708d368f29e6053064c9cf6949ab6ebdbb7ac5 12-Dec-2015 Elliott Hughes <enh@google.com> Share the new adb USB diagnostic code with fastboot.

Bug: http://b/26134129
Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba
/system/core/adb/usb_linux_client.cpp
663e949b2bbda5dcc2b92e4d1936555019cdd66b 08-Dec-2015 David Pursell <dpursell@google.com> Merge "adb: add help text for USB permission errors."
6b531c4e6ddfaef4bef9b04a2d94c56ae85b748d 03-Dec-2015 Josh Gao <jmgao@google.com> adbd: split up writes longer than 16k.

Also, inline the bulk_read and bulk_write functions which were only
being used by one other function.

Bug: http://b/25847115
Change-Id: I218a869030219f606577a5529601c542488115e0
/system/core/adb/usb_linux_client.cpp
d2acbd19312a66cbee2c49f455eddd82b6700d1d 03-Dec-2015 David Pursell <dpursell@google.com> adb: add help text for USB permission errors.

The current permission messages can be confusing for users who don't
know about udev and USB access permissions. This CL adds some checks to
try to identify common udev problems, and adds a link to online
documentation.

Example messages:

1) adb server is in plugdev group but access is still denied:
$ adb devices
List of devices attached
082f59270073e1e3 no permissions (verify udev rules); see [developer.android.com/tools/device.html]

2) plugdev group exists but adb server is not in it:
$ adb shell
error: USB permission failure: udev requires plugdev group membership.
See [developer.android.com/tools/device.html] for more information.

3) plugdev group does not exist:
$ adb shell
error: USB permission failure.
See [developer.android.com/tools/device.html] for more information.

Bug: http://b/25777880
Change-Id: I536565adc12ab657c75151309795674181205db0
/system/core/adb/usb_linux_client.cpp
ca2a0bdcb5badab6b8fc7b752e7ab1963fb660dd 05-Oct-2015 Badhri Jagan Sridharan <Badhri@google.com> adbd: Add os descriptor support for adb.

Eventhough windows does not rely on extended os
descriptor for adbd, when android usb device is
configures as a composite device such as mtp+adb,
windows discards the extended os descriptor even
if one of the USB function fails to send
the extended compat descriptor. This results in automatic
install of MTP driverto fail when Android device is in
"File Transfer" mode with adb enabled.

https://msdn.microsoft.com/en-us/library/windows/hardware/gg463179.aspx

BUG=24583401
BUG=chromium:43409

Change-Id: I87341683a9337848cac66daf9055b0d05cedd3d3
/system/core/adb/usb_linux_client.cpp
aed3c61c4437ebb05eadfb3bf85d6962c30b9935 23-Sep-2015 Yabin Cui <yabinc@google.com> Adb: use VLOG() to replace D() for verbose logging.

As there are too many D(), we can keep both VLOG() and D() now, and get
rid of D() gradually.

Change-Id: I2f1cb70bcab3e82c99fed939341d03f6b2216076
/system/core/adb/usb_linux_client.cpp
7a3f8d6691b3fbd8014a98de8455dbcfcc9629e4 03-Sep-2015 Yabin Cui <yabinc@google.com> adb: clean up debug tracing a little.

Always use LOG() for debug tracing.
Remove useless D_lock. I believe it is useless to lock just before and after fprintf.

I verified the log output both on host and on device. The output looks fine to me.

Change-Id: I96ccfe408ff56864361551afe9ad464d197ae104
/system/core/adb/usb_linux_client.cpp
49ee7cf9a10f66ffa9a3490c69db5fa46e0a966b 29-Aug-2015 Siva Velusamy <vsiva@google.com> adb: set thread names (linux & mac)

Bug: 23423333
Change-Id: I0069f32ddbae2a10fb130064f721facf45b2cc09
/system/core/adb/usb_linux_client.cpp
8fcd8bc046188abe0b0e87754af472d4838b4c50 25-Aug-2015 Elliott Hughes <enh@google.com> EINTR is handled by adb_read/unix_read and friends.

No need to clutter the code with cases that won't happen.

Change-Id: I47c5a2e6170f902d2618719f44492234a4869567
/system/core/adb/usb_linux_client.cpp
e3c028836f892e74c737c8b16ff96321cee82d25 24-Aug-2015 Badhri Jagan Sridharan <badhri@google.com> Merge "adbd: enable USB SuperSpeed (again)"
3d2904cdf2371e26c0465184436bd063979a5d97 13-Jul-2015 Tamas Berghammer <tberghammer@google.com> Increase size of the the adb packets sent over the wire

The reason behing this change is to increase the adb push/pull speed
with reduceing the number of packets sent between the host and the
device because the communication is heavily bound by packet latency.

The change maintains two way compatibility in the communication
protocol with negotiating a packet size between the target and the
host with the CONNECT packets.

After this change the push/pull speeds improved significantly
(measured from Linux-x86_64 with 100MB of data):

| Old push | Old pull || New push | New pull |
-----------------------------------------------------------
Hammerhead | 4.6 MB/s | 3.9 MB/s || 13.1 MB/s | 16.5 MB/s |
-----------------------------------------------------------
Volantis | 6.0 MB/s | 6.2 MS/s || 25.9 MB/s | 29.0 MB/s |
-----------------------------------------------------------
Fugu | 6.0 MB/s | 5.1 MB/s || 27.9 MB/s | 33.2 MB/s |
-----------------------------------------------------------

Change-Id: Id9625de31266e43394289e325c7e7e473379c5d8
/system/core/adb/usb_linux_client.cpp
8d8126a705dd3c5734a0894f88c2c758784bd469 21-Jul-2015 Spencer Low <CompareAndSwap@gmail.com> adb: logging: newlines, thread ids, error code overwriting

Add missing \n to uses of legacy D() macro. This should make the legacy
logging easier to read (and harder to miss important stuff).

On POSIX, use gettid() from libcutils instead of pthread_self() so that
the output shows a more reasonable number instead of a pointer value.
This should be ok since libbase's logging already uses gettid().

Win32:

Don't let the Win32 last error get overwritten by API calls after the
original error'ing API. When encountering an unknown error, log the
specific error code.

Change-Id: Ib8f72754efa7ba895d2f1cd914251fec2a1d894c
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
/system/core/adb/usb_linux_client.cpp
a190c800bf562c2fd2fb113782ff83c1d475ea61 02-Jun-2015 Jack Pham <jackp@codeaurora.org> adbd: enable USB SuperSpeed (again)

The descriptors to enable USB 3.0 SuperSpeed support had previously
been added in commit d6ee9f26a5163af4121f4380264fcbd4e6851a17
but were removed when the v1/v2 descriptor handling was refactored
in commits ab3446dd3400652ecf50682d0e5c4184628e9930 and again in
c49f51c451516bf06afc6d71947eb11cc4627273. Now that the dust has
settled, add back the SS descriptors to re-enable USB 3.0.

Change-Id: I8de7c7e50d9216a7492ce7863e3aaf92ff805eff
/system/core/adb/usb_linux_client.cpp
6ac5d7dc56a016718d2a26803435505e983e5d80 23-May-2015 Spencer Low <CompareAndSwap@gmail.com> adb: fix adb_close() vs. unix_close() usage

Document the differences between adb_*() and unix_*() in the function
prototypes in sysdeps.h. See the file for the details (CR/LF
translation, well-known file descriptors, etc.).

Fix adb_read(), adb_write(), and adb_close() calls that should really be
unix_read(), unix_write(), and unix_close(). Note that this should have
no impact on unix because on unix, unix_read/unix_write/unix_close are
macros that map to adb_read/adb_write/adb_close.

Improve sysdeps_win32.cpp file descriptor diagnostic logging to output
the name of the function that was passed a bad file descriptor.

Change-Id: I0a1d9c28772656c80bcc303ef8b61fccf4cd637c
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
/system/core/adb/usb_linux_client.cpp
c89e0ccd40624e8b2ce30d425e8bed0264fae548 09-May-2015 Dan Albert <danalbert@google.com> Revert "Revert "Split adb_main.cpp into client and daemon.""

This reverts commit 218dbccefa3d874d988e4784bda5e45b7643cb5a.

Change-Id: I74088db34983dc99e316a07c6ddc294340e0eb71
/system/core/adb/usb_linux_client.cpp
218dbccefa3d874d988e4784bda5e45b7643cb5a 09-May-2015 Dan Albert <danalbert@google.com> Revert "Split adb_main.cpp into client and daemon."

This reverts commit cf07494ac2a101c3afbe23a7d85121553f586cf7.
/system/core/adb/usb_linux_client.cpp
cf07494ac2a101c3afbe23a7d85121553f586cf7 06-May-2015 Dan Albert <danalbert@google.com> Split adb_main.cpp into client and daemon.

The name "client" is somewhat misleading as it also contains the host
side adb server, but it's a part of the client binary.

Change-Id: I128b7bab213e330eb21b5010cd1fec5f7a62c8af
/system/core/adb/usb_linux_client.cpp
3edd54b3a873a18d9c2f66ce955036471f4c3c0a 06-May-2015 Elliott Hughes <enh@google.com> Add some missing 'static's.

Change-Id: Id76bb1e954e8fa36a11a38b5445c87f4a64af799
/system/core/adb/usb_linux_client.cpp
9b0f354fa25e3d5add516000c761e07c81c3bbc1 05-May-2015 Elliott Hughes <enh@google.com> Simplify adb_thread_create.

Change-Id: I36d6021ef8fbc23e8bcd4ddbe1dac0eba467cc70
/system/core/adb/usb_linux_client.cpp
dc3b459ff9f0ff71d404ba7198083e532a0dd894 22-Apr-2015 Elliott Hughes <enh@google.com> Add missing null checks after allocations.

Bug: http://b/20317729
Change-Id: I62bb761d48ee59a1f4ddd0cdd0632432305ca2ca
/system/core/adb/usb_linux_client.cpp
5f97370babbe465e82c2aefe9864848af6796113 21-Apr-2015 Badhri Jagan Sridharan <Badhri@google.com> adb: set sys.usb.ffs.ready to signal usb pullup

This change sets sys.usb.ffs.ready to 1 to
trigger configfs based enumeration.

Change-Id: I222495fc667cce59675579069d164b0b484f3653
/system/core/adb/usb_linux_client.cpp
a7090b94c181f3efe5b53d2c8367b78d99074dfe 18-Apr-2015 Elliott Hughes <enh@google.com> Remove yet more fixed-length buffers (and their overruns).

Bug: 20317724
Change-Id: If137fc96f5f23576ccecd388ac87afefa47337c6
/system/core/adb/usb_linux_client.cpp
2acec9153e40a558671ec0544bdd89d5a7fabf08 16-Apr-2015 Elliott Hughes <enh@google.com> Switch usb_linux_client to C++.

Change-Id: I8172e81e6c4665aa16e9e8e0c33b048dbb9ad848
/system/core/adb/usb_linux_client.cpp