summaryrefslogtreecommitdiffstats
path: root/adb/sockets.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Address const issues in preparation for libcxx rebase.Dan Austin2016-03-291-1/+1
| | | | Change-Id: I4eccc1b5a70da9dd325e1a7e10ab0a3fe588c03f
* adb: relax serial matching rules.David Pursell2016-03-021-29/+33
| | | | | | | | | | | | | | | | | | Currently targeting a device by serial requires matching the serial number exactly. This CL relaxes the matching rules for local transports to ignore protocol prefixes and make the port optional: [tcp:|udp:]<hostname>[:port] The purpose of this is to allow a user to set ANDROID_SERIAL to something like "tcp:100.100.100.100" and have it work for both fastboot and adb (assuming the device comes up at 100.100.100.100 in both modes). This CL also adds some unit tests for the modified functions to make sure they work as expected. Bug: 27340240 Change-Id: I006e0c70c84331ab44d05d0a0f462d06592eb879
* Increase the maximum shell command length to 4096ish.Josh Gao2016-01-151-3/+3
| | | | | | | | | | | The actual maximum length will depend on the version of the shell protocol being used, and any additional parameters being passed through (e.g. TERM=xterm-256color). This should be able to be raised to 64K for devices with commit 3d2904c (L-MR1 and above), but that'll require some plumbing. Bug: http://b/20467103 Change-Id: Idf0c46af5b18b854110aba58df13a53297d2475f
* adb/base: minor compiler portability improvementsSpencer Low2015-11-091-0/+2
| | | | | | | | | | | | | | | | | | | | | I've been using these changes to compile with Visual Studio. - GetFileBasename(): __FILE__ uses \ with Visual Studio. - adb_trace.cpp: Apparently VS needs an ampersand before the function name. - "expr1 ? : expr2" is a GCC extension. - <algorithm> contains std::min(). - seekdir can't always be #define'd because some headers have members named seekdir. - adb_utils.cpp: Not really a compiler issue, just a random fix: 0x7F/DEL is not printable. Change-Id: I0dfb634f1ba4ccbc0d1b9f71b00e838fbebb3b41 Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
* Fix adb -d/-e error reporting.Elliott Hughes2015-10-071-10/+8
| | | | | | | | | | | | | | | | If -d/-e fail, get-serialno and friends will now report an error and return a failure status code on exit. Also fix the behavior of -d/-e with $ANDROID_SERIAL --- -d/-e should override $ANDROID_SERIAL, not the other way round. I'm deleting my own comment here about always returning "unknown" for scripts. I can't find any evidence that there are scripts relying on that, so I think my comment meant "I fear that there are scripts doing so". Bug: http://b/24403699 Change-Id: Ie13a751f1137abcfe0cc6c46a0630ba5e02db676
* Adb: use VLOG() to replace D() for verbose logging.Yabin Cui2015-09-231-1/+1
| | | | | | | As there are too many D(), we can keep both VLOG() and D() now, and get rid of D() gradually. Change-Id: I2f1cb70bcab3e82c99fed939341d03f6b2216076
* Add unit tests for local socket.Yabin Cui2015-09-161-2/+6
| | | | | | | | | | | | Add has_write_error flag in asocket, so it will not wait on local_socket_closing_list to write pending packets in local_socket_close(). Although it doesn't fix any problem, it helps to make the code more stable. Add a missing put_apacket() in error handling. Add a check when adding local socket in local_socket_closing_list. Bug: 23314034 Change-Id: I75b07ba8ee59b7f277fba2fb919db63065b291be
* adb: implement shell protocol.David Pursell2015-09-111-2/+3
| | | | | | | | | | | | | | | | | Adds functionality for handling stdin/stdout/stderr streams and exit codes using the shell protocol. This CL just contains implementation for adbd which will not yet be enabled. Once we have the ability to query transport features from the adb client, another CL will add the implementation for the client side and update the feature list to turn this on. Note: this CL must be submitted together with a minadbd CL to update the service_to_fd() function signature. Bug: http://b/23030641 Change-Id: Ibed55e9c1946d8a35190696163ff63e8fb880238
* adb: clean up debug tracing a little.Yabin Cui2015-09-021-46/+46
| | | | | | | | | 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
* adb: remove adisconnect in aremotesocket.Yabin Cui2015-08-271-32/+5
| | | | | | | | | The function of remote_socket_disconnect() is to make sure the local_sockets and remote_sockets are closed when the binded transport is disconnected. However, as we call close_all_sockets() in handle_offline(), we don't need remote_socket_disconnect() any more. Change-Id: I575f632d9f8703149f34e0210eb698a56e2516a9
* adb: fix a data race in local_socket_event_func.Yabin Cui2015-08-261-2/+5
| | | | | | | If s->peer->enqueue() failed, s may be freed. So we should use saved_xxx instead of s->xxx before verifying the return value. Change-Id: I6c072406dceb98e2d02798d0dcdc428fa99e66fb
* Increase size of the the adb packets sent over the wireTamas Berghammer2015-07-221-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Make connection states a proper type.Dan Albert2015-05-181-2/+3
| | | | Change-Id: I809f9b327c832b88dd63151bf7dcb012d88e81c4
* Give enum types CamelCase names for clarity.Elliott Hughes2015-05-051-5/+5
| | | | Change-Id: I1c89f1cc155ee839f372fb14d972a288183b8bcd
* More adb buffer fixes.Elliott Hughes2015-05-011-25/+12
| | | | | | | | | | | | | This patch factors out a lot of the basic protocol code: sending OKAY, sending FAIL, and sending a length-prefixed string. ADB_TRACE has been non-optional for a long time, so let's just remove the #ifs. Also actually build the device tracker test tool (and remove its duplicate). Bug: http://b/20666660 Change-Id: I6c7d59f18707bdc62ca69dea45547617f9f31fc6
* Merge "Remove extern "C" barriers to using C++."Elliott Hughes2015-04-171-2/+2
|\
| * Remove extern "C" barriers to using C++.Elliott Hughes2015-04-171-2/+2
| | | | | | | | Change-Id: Ic046d6aa540738cb46b54531bc59ba3b47b0136d
* | Show $ADB_VENDOR_KEYS if authentication fails.Elliott Hughes2015-04-161-4/+3
|/ | | | | | | | | Incorrectly set $ADB_VENDOR_KEYS is the most likely cause of failed adb connections. Make it easier to debug such problems by including the value in use in the error message. Bug: 20165551 Change-Id: I64c1d98ae6d3fb40eea9e1f0ddcfcf4f2d9d7318
* File header cleanup.Dan Albert2015-03-191-5/+7
| | | | | | | | | * sysdeps.h should always be included first. * TRACE_TAG needs to be defined before anything is included. * Some files were missing copyright headers. * Save precious bytes on my SSD by removing useless whitespace. Change-Id: I88980e6e00b5be1093806cf286740d9e4a033b94
* Move adb to C++.Dan Albert2015-03-091-0/+914
I keep trying to clean things up and needing std::strings. Might as well just do this now. usb_linux_client.c is going to stay as C because GCC isn't smart enough to deal with the designated initializers it uses (though for some reason it is in C mode). The Darwin files are staying as C because I don't have a way to test that they build. The Windows files are staying as C because while I can actually build for them, it's slow and painful. Change-Id: I75367d29205a9049d34460032b3bb36384f43941