1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-05 06:27:37 +00:00

devel/android-tools-{adb,fastboot}-devel: update to m.p.5956

Changes:	0bb1ce06ea..461a29540c/adb
Changes:	0bb1ce06ea..461a29540c/fastboot
This commit is contained in:
Jan Beich 2015-12-16 01:55:44 +00:00
parent 1f64766cad
commit 7cdb29d2e2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=403829
13 changed files with 331 additions and 23 deletions

View File

@ -1,8 +1,8 @@
# $FreeBSD$
# Hint: git describe --abbrev=12 --match android-m-preview
DISTVERSION= m-preview-5498
DISTVERSIONSUFFIX= -g0bb1ce06ea46
DISTVERSION= m-preview-5956
DISTVERSIONSUFFIX= -g461a29540c01
PORTREVISION= 0
PKGNAMESUFFIX= -devel
@ -17,18 +17,14 @@ OPTIONS_DEFINE= TEST_PYTHON
TEST_PYTHON_DESC= ${TEST_DESC:S/tests/python &/}
TEST_PYTHON_GH_PROJECT= platform_development:development
TEST_PYTHON_GH_TAGNAME= ${DISTVERSIONFULL:C/-[0-9].*//}-2403-g084d084:development
TEST_PYTHON_GH_TAGNAME= ${DISTVERSIONFULL:C/-[0-9].*//}-2510-g72f24a0:development
TEST_PYTHON_BUILD_DEPENDS=${PYTHON_PKGNAMEPREFIX}mock>0:${PORTSDIR}/devel/py-mock
TEST_PYTHON_USES= python:2.7,build
pre-install-TEST_PYTHON-on:
# XXX python tests may leave behind running adb server
# test_adb.py remains in core repository for some reason
${SETENV} PATH=${BUILD_WRKSRC}:${PATH} \
PYTHONPATH=${WRKSRC_development}/python-packages \
${PYTHON_CMD} ${BUILD_WRKSRC}/test_adb.py
${SETENV} PATH=${BUILD_WRKSRC}:${PATH} \
PYTHONPATH=${WRKSRC_development}/python-packages \
${PYTHON_CMD} ${WRKSRC_development}/python-packages/adb/test_device.py
${PYTHON_CMD} -m unittest discover -vs ${BUILD_WRKSRC}
.include "${MASTERDIR}/Makefile"

View File

@ -1,6 +1,6 @@
SHA256 (android-platform_system_core-android-m-preview-5498-g0bb1ce06ea46_GH0.tar.gz) = 6495262da5f639cb76625437c82475c6220cab208666cf739508871ce36e79da
SIZE (android-platform_system_core-android-m-preview-5498-g0bb1ce06ea46_GH0.tar.gz) = 1407054
SHA256 (android-platform_system_core-android-m-preview-5956-g461a29540c01_GH0.tar.gz) = 369b2d67c7887124d4d31e1d51934517d243a4c39f266f3685e709f8592b7d14
SIZE (android-platform_system_core-android-m-preview-5956-g461a29540c01_GH0.tar.gz) = 1428466
SHA256 (mbrubeck-android-completion-3b0fabe_GH0.tar.gz) = dc774f101acd9514baf3e7a0ac610068116f2c093b94987ba59203a39a6439dc
SIZE (mbrubeck-android-completion-3b0fabe_GH0.tar.gz) = 5948
SHA256 (android-platform_development-android-m-preview-2403-g084d084_GH0.tar.gz) = a7c33bf2708d61ae2e44ff149fac2460f80746e7da936f08b373841be5750102
SIZE (android-platform_development-android-m-preview-2403-g084d084_GH0.tar.gz) = 183883403
SHA256 (android-platform_development-android-m-preview-2510-g72f24a0_GH0.tar.gz) = a7e3172a61be2b7545fb4c10d5516cceb68b574cf7c83b7fc00c5cac0527b182
SIZE (android-platform_development-android-m-preview-2510-g72f24a0_GH0.tar.gz) = 183871106

View File

@ -17,6 +17,7 @@ SRCS+= adb_trace.cpp
SRCS+= adb_utils.cpp
SRCS+= commandline.cpp
SRCS+= console.cpp
SRCS+= diagnose_usb.cpp
SRCS+= fdevent.cpp
SRCS+= file_sync_client.cpp
SRCS+= line_printer.cpp

View File

@ -0,0 +1,11 @@
--- base/include/android-base/logging.h.orig 2015-09-29 18:07:07 UTC
+++ base/include/android-base/logging.h
@@ -25,6 +25,8 @@
#endif
#endif
+#include <errno.h>
+
#include <functional>
#include <memory>
#include <ostream>

View File

@ -0,0 +1,40 @@
--- base/logging.cpp.orig 2015-12-14 21:12:52 UTC
+++ base/logging.cpp
@@ -66,6 +68,16 @@
#include <unistd.h>
#elif defined(_WIN32)
#include <windows.h>
+#elif defined(__DragonFly__)
+#include <unistd.h>
+#elif defined(__FreeBSD__)
+#include <sys/param.h>
+#include <sys/thr.h>
+#include <pthread_np.h>
+#elif defined(__NetBSD__)
+#include <lwp.h>
+#else
+#include <stdint.h>
#endif
static pid_t GetThreadId() {
@@ -77,6 +89,20 @@ static pid_t GetThreadId() {
return syscall(__NR_gettid);
#elif defined(_WIN32)
return GetCurrentThreadId();
+#elif defined(__DragonFly__)
+ return lwp_gettid();
+#elif defined(__NetBSD__)
+ return _lwp_self();
+#elif defined(__FreeBSD__)
+# if __FreeBSD_version > 900030
+ return pthread_getthreadid_np();
+# else
+ long lwpid;
+ thr_self(&lwpid);
+ return lwpid;
+# endif
+#else
+ return (intptr_t) pthread_self();
#endif
}

View File

@ -25,6 +25,7 @@ GH_REVISION= f7f765fd62bf # generated by: make update-revision
CONFLICTS_INSTALL?= ${PORTNAME}-devel-*
.ifndef EXTRA_PATCHES
EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-base_include_base_logging.h
EXTRA_PATCHES+= ${PATCHDIR}/extra-patch-base_file__test.cpp
.endif

View File

@ -1,17 +1,18 @@
# $FreeBSD$
# Hint: git describe --abbrev=12 --match android-m-preview
DISTVERSION= m-preview-5498
DISTVERSIONSUFFIX= -g0bb1ce06ea46
DISTVERSION= m-preview-5956
DISTVERSIONSUFFIX= -g461a29540c01
PORTREVISION= 0
PKGNAMESUFFIX= -devel
GH_TAGNAME= ${DISTVERSIONFULL:C/-[0-9].*//}-972-g442e952:extras \
${DISTVERSIONFULL:C/-[0-9].*//}-90-ga83098b:libselinux
GH_TAGNAME= ${DISTVERSIONFULL:C/-[0-9].*//}-1071-g4f5860d:extras \
${DISTVERSIONFULL:C/-[0-9].*//}-94-gbe5f860:libselinux
CONFLICTS_INSTALL= ${PORTNAME}-[0-9]*
MASTERDIR= ${.CURDIR}/../android-tools-fastboot
FILESDIR= ${.CURDIR}/files
DISTINFO_FILE= ${.CURDIR}/distinfo
.include "${MASTERDIR}/Makefile"

View File

@ -1,10 +1,10 @@
SHA256 (fastboot.1?id=706e754) = 2af01b064440952a82f1602691a0fecc030302722a71444946fb70d9c423d283
SIZE (fastboot.1?id=706e754) = 5906
SHA256 (android-platform_system_core-android-m-preview-5498-g0bb1ce06ea46_GH0.tar.gz) = 6495262da5f639cb76625437c82475c6220cab208666cf739508871ce36e79da
SIZE (android-platform_system_core-android-m-preview-5498-g0bb1ce06ea46_GH0.tar.gz) = 1407054
SHA256 (jbeich-platform_system_extras-android-m-preview-972-g442e952_GH0.tar.gz) = 77082c3fae368dda9fe0a7edb2b54cfb3c47a849f5fe3ab160225304e3598e1e
SIZE (jbeich-platform_system_extras-android-m-preview-972-g442e952_GH0.tar.gz) = 76529760
SHA256 (jbeich-platform_external_libselinux-android-m-preview-90-ga83098b_GH0.tar.gz) = 05afbdfad4028c4cdc62d1fa831760cded52883749e686a5c0cea5901d5aa33c
SIZE (jbeich-platform_external_libselinux-android-m-preview-90-ga83098b_GH0.tar.gz) = 58818
SHA256 (android-platform_system_core-android-m-preview-5956-g461a29540c01_GH0.tar.gz) = 369b2d67c7887124d4d31e1d51934517d243a4c39f266f3685e709f8592b7d14
SIZE (android-platform_system_core-android-m-preview-5956-g461a29540c01_GH0.tar.gz) = 1428466
SHA256 (jbeich-platform_system_extras-android-m-preview-1071-g4f5860d_GH0.tar.gz) = 31376565de222f87cbcea4786346a198432c6aae257a857d7afa4ec1e3b5997d
SIZE (jbeich-platform_system_extras-android-m-preview-1071-g4f5860d_GH0.tar.gz) = 76521949
SHA256 (jbeich-platform_external_libselinux-android-m-preview-94-gbe5f860_GH0.tar.gz) = 596a151d25a0cf1e39abc3157ea91f1c69471a9bb41859e915f6c4ac5efaf2c0
SIZE (jbeich-platform_external_libselinux-android-m-preview-94-gbe5f860_GH0.tar.gz) = 58977
SHA256 (mbrubeck-android-completion-3b0fabe_GH0.tar.gz) = dc774f101acd9514baf3e7a0ac610068116f2c093b94987ba59203a39a6439dc
SIZE (mbrubeck-android-completion-3b0fabe_GH0.tar.gz) = 5948

View File

@ -17,10 +17,15 @@ SRCS+= util.cpp
SRCS+= usb_freebsd.cpp
SRCS+= util_freebsd.cpp
# required by fastboot and libziparchive
# required by fastboot
.PATH: ${.CURDIR}/../adb
SRCS+= diagnose_usb.cpp
# required by fastboot, diagnose_usb and libziparchive
.PATH: ${.CURDIR}/../base
SRCS+= file.cpp
SRCS+= strings.cpp
SRCS+= stringprintf.cpp
# required by fastboot
.PATH: ${.CURDIR}/../ext4_utils
@ -81,6 +86,7 @@ CPPFLAGS+= -Dmmap64=mmap
CPPFLAGS+= -Dpread64=pread
CPPFLAGS+= -I${.CURDIR}
CPPFLAGS+= -I${.CURDIR}/../include
CPPFLAGS+= -I${.CURDIR}/../adb
CPPFLAGS+= -I${.CURDIR}/../mkbootimg
CPPFLAGS+= -I${.CURDIR}/../base/include
CPPFLAGS+= -I${.CURDIR}/../ext4_utils

View File

@ -0,0 +1,7 @@
The port installed fastboot(1) under %%PREFIX%%/bin. However, there's
a different fastboot(8) under /sbin. To avoid accidentally invoking
the wrong command make sure either to
- adjust PATH environment variable to have fastboot(1) found first
- create a shell alias with absolute path to fastboot(1)
- create a symlink with different name in PATH e.g., under ~/bin

View File

@ -0,0 +1,208 @@
/*
* Copyright (C) 2011 Hans Petter Selasky. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libusb.h>
#include <memory>
#include "usb.h"
struct usb_handle {
libusb_device_handle *handle;
libusb_device *dev;
unsigned char ep_in;
unsigned char ep_out;
unsigned char iface;
};
class LibusbUsbTransport : public Transport {
public:
LibusbUsbTransport(std::unique_ptr<usb_handle> handle):
h(std::move(handle)) {}
~LibusbUsbTransport() override = default;
ssize_t Read(void *_data, size_t len) override;
ssize_t Write(const void *_data, size_t len) override;
int Close() override;
private:
std::unique_ptr<usb_handle> h;
DISALLOW_COPY_AND_ASSIGN(LibusbUsbTransport);
};
static int
probe(std::unique_ptr<usb_handle> &h, ifc_match_func callback)
{
usb_ifc_info info;
libusb_device_descriptor ddesc;
libusb_config_descriptor *pcfg;
int i, j;
if (libusb_open(h->dev, &h->handle) < 0)
return (-1);
if (libusb_get_device_descriptor(h->dev, &ddesc) < 0) {
libusb_close(h->handle);
return (-1);
}
memset(&info, 0, sizeof(info));
info.dev_vendor = ddesc.idVendor;
info.dev_product = ddesc.idProduct;
info.dev_class = ddesc.bDeviceClass;
info.dev_subclass = ddesc.bDeviceSubClass;
info.dev_protocol = ddesc.bDeviceProtocol;
info.writable = 1;
snprintf(info.device_path, sizeof(info.device_path), "ugen%d.%d",
libusb_get_bus_number(h->dev), libusb_get_device_address(h->dev));
if (ddesc.iSerialNumber != 0) {
libusb_get_string_descriptor_ascii(h->handle, ddesc.iSerialNumber,
(unsigned char *)info.serial_number, sizeof(info.serial_number));
}
if (libusb_get_active_config_descriptor(h->dev, &pcfg)) {
libusb_close(h->handle);
return (-1);
}
for (i = 0; i < pcfg->bNumInterfaces; i++) {
h->ep_in = 0;
h->ep_out = 0;
h->iface = i;
for (j = 0; j < pcfg->interface[i].altsetting[0].bNumEndpoints; j++) {
unsigned char temp = pcfg->interface[i].altsetting[0].
endpoint[j].bEndpointAddress;
unsigned char type = pcfg->interface[i].altsetting[0].
endpoint[j].bmAttributes & 0x03;
/* check for BULK endpoint */
if ((type & 0x03) == 0x02) {
/* check for IN endpoint */
if (temp & 0x80)
h->ep_in = temp;
else
h->ep_out = temp;
}
}
info.ifc_class = pcfg->interface[i].altsetting[0].bInterfaceClass;
info.ifc_subclass = pcfg->interface[i].altsetting[0].bInterfaceSubClass;
info.ifc_protocol = pcfg->interface[i].altsetting[0].bInterfaceProtocol;
info.has_bulk_in = (h->ep_in != 0);
info.has_bulk_out = (h->ep_out != 0);
if (libusb_claim_interface(h->handle, h->iface) < 0)
continue;
if (callback(&info) == 0) {
libusb_free_config_descriptor(pcfg);
return (0);
}
libusb_release_interface(h->handle, h->iface);
}
libusb_free_config_descriptor(pcfg);
libusb_close(h->handle);
return (-1);
}
static std::unique_ptr<usb_handle>
enumerate(ifc_match_func callback)
{
static libusb_context *ctx = NULL;
std::unique_ptr<usb_handle> h;
libusb_device **ppdev;
ssize_t ndev;
ssize_t x;
if (ctx == NULL)
libusb_init(&ctx);
ndev = libusb_get_device_list(ctx, &ppdev);
for (x = 0; x < ndev; x++) {
h.reset(new usb_handle);
h->dev = ppdev[x];
if (probe(h, callback) == 0) {
libusb_ref_device(h->dev);
libusb_free_device_list(ppdev, 1);
return (h);
}
}
h.reset();
libusb_free_device_list(ppdev, 1);
return (nullptr);
}
ssize_t
LibusbUsbTransport::Write(const void *_data, size_t len)
{
int actlen;
if (libusb_bulk_transfer(h->handle, h->ep_out,
(unsigned char *)_data, len, &actlen, 0) < 0)
return (-1);
return (actlen);
}
ssize_t
LibusbUsbTransport::Read(void *_data, size_t len)
{
int actlen;
if (libusb_bulk_transfer(h->handle, h->ep_in,
(unsigned char *)_data, len, &actlen, 0) < 0)
return (-1);
return (actlen);
}
int
LibusbUsbTransport::Close()
{
libusb_close(h->handle);
h->handle = NULL;
libusb_unref_device(h->dev);
h.reset();
return (0);
}
Transport *
usb_open(ifc_match_func callback)
{
std::unique_ptr<usb_handle> h = enumerate(callback);
return (h ? new LibusbUsbTransport(std::move(h)) : nullptr);
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2011 Hans Petter Selasky. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "fastboot.h"
#include <unistd.h>
#include <limits.h>
void
get_my_path(char *path)
{
getcwd(path, PATH_MAX - 1);
}