* commit 'f75a2ed2138cd8b74597bd57e13d12e1f0b815c2':
adb: Add vendor IDs for iRiver, Compal and T & A Mobile Phones
Add Gigabyte's USB vendor ID to adb.
Add Funai's USB vendor ID to adb.
The adb gadget driver used to reset the USB bus when the adbd daemon exited,
and the host side adb relied on this behavior to force it to reconnect
with the new adbd instance after init relaunches it. The new gadget
drivers no longer automatically reset the USB bus when adbd is restarted
which caused adb to hang since it was no longer forced to reconnect with the
device. We attempted to work around this on the host side adb, but that
work around has not been reliable.
This change adds a property trigger on the service.adb.root system property
which will reset the USB bus and restart the adbd daemon when adbd sets
the property to 1. This should be much closer to the previous behavior
and will hopefully fix some problems with automated testing.
Change-Id: I177c37400009a3d83f21a5f9431f94fd1cc19b9b
Signed-off-by: Mike Lockwood <lockwood@android.com>
This reverts commit d15e6ac95d.
Also increment adb version to 1.0.29
Change-Id: I890643f0c18a2fe90f170134df039c54116cecda
Signed-off-by: Mike Lockwood <lockwood@android.com>
The buggy behavior was that the 'adb backup ....' host command line
invocation would hang forever, even after the backup finished and
the forked device-side subprocess had been reaped. The reason for
this is that the device adbd end of the socketpair used to send
the data back from the forked subprocess was still stuck readable
even after the remote end of it had been closed.
With this patch, the thread whose job it is to waitpid() in order
to harvest the forked child process also closes the local (adbd)
end of the socketpair. This makes the fdevent logic notice that
the socket is dead, at which point it cleans up everything including
the communication back to the host.
Change-Id: I90e7e4e5db36c5a6f7363708b29a6d2c56d1250e
* Increase transfer buffer size to 32K
* Add logging about error conditions and fd teardown
* Pass the fd number as a command line option to the 'bu' subprocess
* Properly harvest the 'bu' subprocess after it's done
Change-Id: Id44dde25778ecf43c5604fd9d01d726ba58861e5
This is needed because the USB driver on the device no longer resets the bus
when exits and restarts.
Since the host side adb no longer detects that adbd has restarted we need
to reset the connection on the host side now.
Change-Id: I1a8eabd292e8b45c34fa07a8a8b8c609cc15648d
Signed-off-by: Mike Lockwood <lockwood@android.com>
Reset peers to NULL after closing them down. This prevents
other code from attempting to access that freed memory
(which prevents crashes). Previously, it left pointers to
freed memory and the "if (s->peer)" guards could not block
the attempt to access that memory later. Resolves many
crashes seen while taking repeated screenshots on WinXP.
Change-Id: I32553f4d19f6ddc9b05b6ab4dc1e9efe69e5be4f
* "adb backup" as the entire command line no longer crashes
* The "-f filename" option can now appear anywhere in the command line.
A trailing "-f" at EOL prompts an error message and usage summary.
Change-Id: I040ed73c2ca3687e265e35600eb3ab2b3c879695
It won't actually do anything until the 'bu' tool and framework are
updated to respond properly, but this is the adb side of the
necessary infrastructure: we copy the tarfile into the socket pointed
at the device, using the existing mechanisms.
Change-Id: Ic3b5779ade256bd1ad989a94b0685f7b1a7d59d2
Includes a version bump to make it possible to determine if a given
binary has this fix or not.
Bug: 4111855
Change-Id: I86d902a7fa0c4b906264141d2467b7bdddb61801
* Add support for correctly handling subprocess termination in shell service (b/3400254 b/3482112 b/2249397)
- have a waitpid() track the subprocess, then notify the fdevent via a socket
- force an eof on the pty master in fdevent's new subproc handler.
- modify fdevent to force-read the pty after an exit.
* Migrate the "shell:blabla" handling to "#if !ADB_HOST" sections, where it
belongs.
* Fix the race around OOM adjusting.
- Do it in the child before exec() instead of the in the parent as the
child could already have started or not (no /proc/pid/... yet).
* Allow for multi-threaded D() invocations to not clobber each other.
- Allow locks across object files.
- Add lock within D()
- Make sure sysdesp init (mutex init also) is called early.
* Add some missing close(fd) calls
- Match similar existing practices near dup2()
* Add extra D() invocations related to FD handling.
* Warn about using debugging as stderr/stdout is used for protocol.
* Fix some errno handling and make D() correctly handle it.
* Add new adb trace_mask: services.
* Make fdevent_loop's handle BADFDs more gracefully (could occur some subproc closed its pts explicitely).
* Remove obsolete commandline args reported in help. (b/3509092)
Change-Id: I928287fdf4f1a86777e22ce105f9581685f46e35
Ext4 filesystems like to be unmounted before rebooting. The Android system
doesn't have a traditional Linux init setup, and shutting down the system
was not much more than calling sync(2) and reboot(2). This adds a new
function to libcutils called android_reboot(). By default, it calls sync()
and then remounts all writable filesystems as read-only and marks them clean.
There is a flag parameter in which the caller can ask for sync() not to be
called, or to not remount the filesystems as read-only. Then it will call
reboot(2) as directed by the other parameters. This change also updates
adb, init and toolbox to call the new android_reboot() function.
Fixes bugs 3350709 and 3495575.
Change-Id: I16d71ffce3134310d7a260f61ec6f4dd204124a7
This is for http://b/3482112 "adb interactions with device causing test harness failures".
This reverts commit 69c5c4c45b.
Change-Id: I630bf2e04d2ecf0223bd2af4e87136754ff880d3
* Handling of the subprocess and its FD.
This fixes http://b/3400254 "Many bugreports getting hung at the end in monkey"
- Start up a service thread that waits on the subprocess to terminate,
then closes the FD associated with it.
- Have the event handler select() with a timeout so that it can
detect the closed FD. Select() with no timeout does not return when an FD is closed.
- Have the event handler force a read on the closed FD to trigger the close sequence.
- Migrate the "shell:blabla" handling to "#if !ADB_HOST" sections.
* Fix the race around OOM adjusting.
- Do it in the child before exec() instead of the in the parent as the
child could already have started or not (no /proc/pid/... yet).
* Allow for multi-threaded D() invocations to not clobber each other.
- Allow locks across object files.
- Add lock within D()
* Add some missing close(fd) calls
- Match similar existing practices near dup2()
* Add extra D() invocations related to FD handling.
* Warn about using debugging as stderr/stdout is used for protocol.
Change-Id: Ie5c4a5e6bfbe3f22201adf5f9a205d32e069bf9d
Signed-off-by: JP Abgrall <jpa@google.com>
* commit 'd4894f4be608c28ef0f39c7794ba865ac812dff9':
Fix adb leaking file descriptors to forked processes
adb: Fix command-line parser.
adb: Increase device descriptor buffer size in Linux host USB support
adb: improve debug traces readability.
adb: Don't report negative number of bytes after pushing file > 2 gigabytes
Adding Texas Instruments to the VID list.
Support an additional alias for 'adb shell.'
accept() creates a new file descriptor that should be closed on exec so
that forked processes don't keep a fd opened on the socket.
This also fixes b/3297070 where adb hangs after running adb on the
target.
Change-Id: I8df511289e5549ae49b4824c9dfb71a3bf85eae8
This fixes the command-line parser to accept both "daemon server"
and "server nodaemon". Before the patch, the second string would
ignore the "nodaemon" flag.
Fixes b/2191598
Change-Id: Ie922b3e7bf57a6e334fc448cec33fb340ca6abc4
256 bytes wasn't big enough for some complicated USB configurations
Change-Id: I31f7841953d73b06958f44040f58166b159faff4
Signed-off-by: Mike Lockwood <lockwood@android.com>
This patch makes the traces easier to read. For example transports are
displayed by name/serial instead of their hex address.
Change-Id: I7e8df44ddbec19754d63d989bd56485998b4627b
256 bytes wasn't big enough for some complicated USB configurations
Change-Id: I31f7841953d73b06958f44040f58166b159faff4
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit '6713a2e0c659be9d992e75ab420da5680f522658' into gingerbread-plus-aosp
* commit '6713a2e0c659be9d992e75ab420da5680f522658':
Fix USB endianness bugs on Linux.
Merge commit '81347d2764b32ec7224d4e2ab3348103816400b2' into gingerbread-plus-aosp
* commit '81347d2764b32ec7224d4e2ab3348103816400b2':
adb: Improved detection of big endian architecture
Merge commit 'a8b8c0e21ac4bdb7838c8c1b8e7d60f632eda79b'
* commit 'a8b8c0e21ac4bdb7838c8c1b8e7d60f632eda79b':
adb: Add support for Philips's USB vendor ID
The fields device->idVendor and device->idProduct should not be
converted from little endian to native byteorder, because the
kernel has in fact done so already!
On the other hand, the descriptors read using raw ioctl:s in
register_device() do need to be converted.
Change-Id: I5fe08b626b14ead56a592b68d026690e343c2656
Instead of testing for the (compiler specific) define
__ppc__ explicitly, use the define HAVE_BIG_ENDIAN provided by
AndroidConfig.h. That way, it should work on all big endian
systems.
Change-Id: Ic4d62afcefce4c8ad5716178ebfcb2b055ac73ce
Merge commit 'd02e521d79a49471b3f1dc3717e842948df64789' into gingerbread-plus-aosp
* commit 'd02e521d79a49471b3f1dc3717e842948df64789':
adb: Add support for Philips's USB vendor ID
Merge commit '89aff1d22662c64cc2de384e7e2c699e4d1d5d47' into gingerbread-plus-aosp
* commit '89aff1d22662c64cc2de384e7e2c699e4d1d5d47':
Add Asus USB vendor ID to adb.
Added a new target for adb, so that the adb
host executable is built for the target as
well. This allows the target to connect to
any Android devices which are attached to it.
Bug: 3022194
Change-Id: Ib01983e70b75cec40a9ee161da7f4cf1343eecf2
Merge commit 'f62b23f2c1540221621024c850fdf615dda0c903' into gingerbread-plus-aosp
* commit 'f62b23f2c1540221621024c850fdf615dda0c903':
Add new USB vendor IDs.
Merge commit '4309d602b562eb9f181b0314837e6096577c6c18' into gingerbread-plus-aosp
* commit '4309d602b562eb9f181b0314837e6096577c6c18':
Added Toshiba's USB VID (0x0930) upon their request.
to print msg.command as some odd decimal number is just not helping in debugging;
instead print msg.command as a string
Change-Id: Id1ec770c20c86b8bdae40a0262bf4b63c0213b0a
The ADB (Android Debug Bridge) daemon suffers from a file descriptor leak.
When transfering file descriptors, opened by the adbd daemon, to a JDWP
process for debugging through sendmsg, the file descriptor is duplicated
by the kernel and a copy is transfered to the JDWP process.
Adbd neglects to close it's copy of the descriptor after the sendmsg call
which causes a file descriptor leak in the process.
Eventually this causes the daemon to hit its maximum roof of opened file
descriptors thus making it impossible for the process to serve any new
commands from the adb server.
Jdwp_service.c has been modified to close the file descriptor after the
send message call has succeded.
Also, the socket used for transfering the file descriptor is set to blocking
mode before the sendmsg call since the adbd processes needs to know when the
duplication has been completed by the kernel.
The flags are reset to its original state after the sendmsg call.
Change-Id: I76b15460301ac01e432f5ce8678ff58c658c16f2
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
... as memory was already obtained zero'ed by calloc().
Change-Id: Ic73bad09b54cb778fd40bdf86bb40888ea504c5f
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Port number is now optional. Will use default port 5555 if not specified.
"adb disconnect" with no additional arguments will disconnect all TCP devices.
Change-Id: I7fc26528ed85e66a73b8f6254cea7bf83d98109f
Signed-off-by: Mike Lockwood <lockwood@android.com>
The linenoise library is from http://github.com/antirez/linenoise
This patch also disables command-line editing and history from adb. The
adb implementation was shadowing the Android shell's implementation.
The adb implementation was also shadowing the editing and history
implementation in alternative shells such as BusyBox's ash.
Change-Id: I7ebd4cb391d0ce966c0ce0e707d80ecd659f9079
- adb can now connect to an emulator configured with an arbitrary
pair of <console port, adb port>. These two ports do not have to be
adjacent.
This can be done from the commandline at any time using
adb connect emu:<console_port>,<adb_port>
- Emulators running on ports outside the normal range
(5554/5555-5584/5585) register themselves on startup if they follow
the convention "console port+1==abd port".
- Emulators outside the normal port range will not be auto-detected on
adb startup as these ports are not probed.
- The index into local_transports[] array in transport_local.c does no
longer indicate the port number of the local transport. Use the altered
atransport struct to get the port number.
- I have chosen not to document the adb connect emu:console_port,adb_port
syntax on adb's help screen as this might be confusing to most readers
and useful to very few.
- I don't expect this to introduce any (backwards) compatibility issues.
Change-Id: Iad3eccb2dcdde174b24ef0644d705ecfbff6e59d
Signed-off-by: Mike Lockwood <lockwood@android.com>
This is the first CL of a somewhat larger effort which, among other things,
will involve changing the emulator and ddms to talk to adb running on a
configurable port.
The port can be configured using environment variable ANDROID_ADB_SERVER_PORT.
Further CLs will also address the set of ports used for the local transport.
Change-Id: Ib2f431801f0adcd9f2dd290a28005644a36a780a
This was used for adb networking, which no longer exists.
This code also failed when adb was not running as root.
Change-Id: Ied86fb1930094d5ae5009684d25e15385fd31d03
Signed-off-by: Mike Lockwood <lockwood@android.com>
This helps us recover when things go wrong during automated testing.
Change-Id: I006dbfaff7f70d51398ff12fbddcaee751453b78
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit 'b419c35c660d7421e18a9efef38eca11966b44c7' into froyo-plus-aosp
* commit 'b419c35c660d7421e18a9efef38eca11966b44c7':
Fix adb, fastboot to compile in Windows SDK under Linux.
In addition to service.adb.tcp.port, you can now set persist.adb.tcp.port
to specify the port number for adb to listen to instead of USB.
This allows the adb TCP configuration to persist across reboots.
Change-Id: I897ffcb019e8dd1785996d2f3c571cfc2f8ded38
Signed-off-by: Mike Lockwood <lockwood@android.com>
This helps us recover when things go wrong during automated testing.
Change-Id: I006dbfaff7f70d51398ff12fbddcaee751453b78
Signed-off-by: Mike Lockwood <lockwood@android.com>
indirectly via system service) rather than "dumpstate", that way
even when adb is not running as root, dumpstate does run as root,
and can do things like collect VM traces.
Merge commit '1873adc2b12d5a9045bae90650bb331c7c7aa3c7' into eclair-plus-aosp
* commit '1873adc2b12d5a9045bae90650bb331c7c7aa3c7':
ADB: Garmin-Asus's USB Vendor ID
indirectly via system service) rather than "dumpstate", that way
even when adb is not running as root, dumpstate does run as root,
and can do things like collect VM traces.
Merge commit 'ef063fe3066153dab5389b6baba6cb4e36888106'
* commit 'ef063fe3066153dab5389b6baba6cb4e36888106':
Add support for Acer devices
FreeBSD support for usb-connected devices in adb
Make get_my_path() safer
Fix use of memset function
FreeBSD (and other systems as well) may use libusb to work with USB devices.
libusb is integrated in FreeBSD base system in recent builds (8.0+),
however in other systems it may need include libusb.h like <libusb/libusb.h>
and install library from devel/libusb port or other repository.
Submitted change not supports events (attach/detach) as libusb 1.0 lacks
such functionality and in order to make code more portable I've not used
workarounds as in earlier changeset.
Code was tested on FreeBSD 8.0-RC1, HTC Hero (1.0.0.A6288, Android 1.5)
Also check that device is not already connected in "adb connect"
Change-Id: I5f84b56b63d8c6932f23791cac319fd6bc39d36c
Signed-off-by: Mike Lockwood <lockwood@android.com>
Also check that device is not already connected in "adb connect"
Change-Id: I5f84b56b63d8c6932f23791cac319fd6bc39d36c
Signed-off-by: Mike Lockwood <lockwood@android.com>
between various 32 bit pixel formats. Also adds new version number for
future expansion.
Change-Id: Ia1d7d7485614e961a47ebb65493b19f4a16ded05
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
-supports fb's with x and y offsets
-dumps the front buffer (instead of just the low end of the buffer)
-switch from mmap to read/write, for fb's with very large offsets
Change-Id: Id560790c9661f7cc3b4350a44cc29f0104831e85
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
This reverts commit be0045aafd.
This change broke compatibility with previous versions of adbd, so I will be implementing this
by modifying the bugreport command on the device instead.
This allows dumpstate to run as root even if adbd is not.
Change-Id: I04bda1ee0c8de91677149a2a9eda713c85067aa4
Signed-off-by: Mike Lockwood <lockwood@android.com>
Added new commands:
adb connect <host>:<port> (to connect to a device via TCP/IP)
adb tcpip <port> (to restart adbd on the device to listen on TCP/IP)
adb usb (to restart adbd on the device to listen USB)
Signed-off-by: Mike Lockwood <lockwood@android.com>
Now, a command like "adb shell" will print "insufficient permissions for device"
instead of "device not found" if adb does not have permissions to communicate with the device.
Signed-off-by: Mike Lockwood <lockwood@android.com>
adb devices will now list devices without adequate file system permissions in /dev/bus/usb as:
List of devices attached
???????????? no permissions
Signed-off-by: Mike Lockwood <lockwood@android.com>
This will allow rebooting the device via adb on any build, including user builds.
An optional argument can be provided
(for example, "adb reboot bootloader" or adb reboot recovery")
Signed-off-by: Mike Lockwood <lockwood@android.com>
Added new commands:
adb connect <host>:<port> (to connect to a device via TCP/IP)
adb tcpip <port> (to restart adbd on the device to listen on TCP/IP)
adb usb (to restart adbd on the device to listen USB)
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit 'e3baafd85a5fecd1714441455e3f75f26b5c381e'
* commit 'e3baafd85a5fecd1714441455e3f75f26b5c381e':
BUG 2033924: Add AdbWinUsbApi.dll to prebuilt for Windows SDK
adb: add "adb reboot" command.
This will allow rebooting the device via adb on any build, including user builds.
An optional argument can be provided
(for example, "adb reboot bootloader" or adb reboot recovery")
Signed-off-by: Mike Lockwood <lockwood@android.com>
Now, a command like "adb shell" will print "insufficient permissions for device"
instead of "device not found" if adb does not have permissions to communicate with the device.
Signed-off-by: Mike Lockwood <lockwood@android.com>
adb devices will now list devices without adequate file system permissions in /dev/bus/usb as:
List of devices attached
???????????? no permissions
Signed-off-by: Mike Lockwood <lockwood@android.com>
This will allow rebooting the device via adb on any build, including user builds.
An optional argument can be provided
(for example, "adb reboot bootloader" or adb reboot recovery")
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit 'cc1de48dcdf06c76ee14abbe2a237aa51b5b3bad'
* commit 'cc1de48dcdf06c76ee14abbe2a237aa51b5b3bad':
adb: Another attempted workaround for the adb disconnect problem.
For adb shell commands (as well as shell based commands like logcat and bugreport) we now
batch USB writes into 4K chunks instead of sending small packets of data as they come in.
A timeout prevents us from blocking for more than 100ms when our 4K buffer is partially full.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit 'de6f62a609120c3d9e4e53689c3b309842ec874b'
* commit 'de6f62a609120c3d9e4e53689c3b309842ec874b':
Add support for Samsung and Motorola devices.
Also update the linux code. Some devices have more complex USB descriptors
which can't be parsed with the simple assumption of just skipping the
endpoint descriptors.
It was pointed out that we should have done this when we added the "adb root" command.
And doing this will also force people to pick up the recent Linux USB serial number fix.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit '3d9b265b7d34d886a2f44e486c25e402d7df791b'
* commit '3d9b265b7d34d886a2f44e486c25e402d7df791b':
adb: Use correct language ID when retrieving USB serial number.
This reverts commit e38a31e305.
This change had the unfortunate side effect of breaking ctrl-C
when executing "adb shell <command>"
Signed-off-by: Mike Lockwood <lockwood@android.com>
For non-interactive adb shell commands, batch USB writes into 4K chunks
instead of sending small packets of data as they come in.
Add a timeout so we do not block for more than 200ms when our 4K buffer is partially full.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit '1f546e6d1f6ccd1964336ddf0d8e8b3b11b1e945'
* commit '1f546e6d1f6ccd1964336ddf0d8e8b3b11b1e945':
adb: Allow enabling of device side adbd logging with a persistent system property.
To enable logging, set the property persist.adb.trace_mask to a hex value
containing the bitmask for adb_trace_mask (see the TRACE_* enum values in adb.h).
This will result in adb writing log output to a file in /data/adb/
No logging will occur if persist.adb.trace_mask is not set or has a value
that cannot be parsed as a hex integer.
The property is read once only at startup, so you must reboot or restart adbd
for changes in the property to take effect.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Merge commit '6a3075c78287ea5a7ee7a3c85cde58e894350822'
* commit '6a3075c78287ea5a7ee7a3c85cde58e894350822':
adb: Add adbd to the AID_SDCARD_RW group to allow writing to the SD card.
Merge commit '0469d2c37adddcb30cb0d88772bef33ac26c6500'
* commit '0469d2c37adddcb30cb0d88772bef33ac26c6500':
Support for 3rd party USB Vendor IDs in adb.
Vendor IDs are read from ~/.android/adb_usb.ini. The format is very simple:
1 number per line. First number is ID count, followed by the ID themselves.
Lines starting with # are considered comments.
Other misc changes: moved VENDOR_ID_* to usb_vendors.c to prevent direct
access. Made transport_usb.c reuse the USB constant introduced in usb_osx
(moved them to adb.h)
Merge commit 'a09fbd164d2e088bc5433d310e25640ae048d47d'
* commit 'a09fbd164d2e088bc5433d310e25640ae048d47d':
Preparation work for adb to support USB vendor Ids provided by SDK add-ons.
Added usb_vendors.* which handles creating (and deleting) a list of vendor ids.
This list is meant to be used everywhere the built-in lists (usb_osx), or the
built-in vendor IDs (transport_usb) were used.
For now the list is only built with the built-in VENDOR_ID_*. Next step
is to read a small file created from all the SDK add-on.
Other misc changes: made is_adb_interface present only if ADB_HOST is true
to prevent accessing a list that doesn't exist (usb_vendors is only
compiled for the host version of adb).
Merge commit 'a61755e5fca065dfc89c7639bb672c20a4f9854e'
* commit 'a61755e5fca065dfc89c7639bb672c20a4f9854e':
move native_handle stuff from master_gl
adb: adbd no longer disables OOM and now sets children's OOM adjustment to zero
Merge commit '414ff7d98ac8d7610a26206335954ad15f43f3ac'
* commit '414ff7d98ac8d7610a26206335954ad15f43f3ac':
Move fdevent from libcutils into adb directory. ADB is the only client of this API, and I intend to modify it extensively to clean its codebase soon.
Merge commit '3fd82b8861aa410fab7785074941b459d92220c1'
* commit '3fd82b8861aa410fab7785074941b459d92220c1':
adb: osx: Match devices based on interface subclass and protocol
Enumerating all vendor+product id combinations is not practical.
This modifies the matching algorithm to use the adb interface
subclass/protocol instead (0x42/0x1).
Signed-off-by: Dima Zavin <dima@android.com>