Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Sep 2019 12:52:57 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r511879 - in head/devel/android-tools-fastboot: . files
Message-ID:  <201909121252.x8CCqvFE004351@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Thu Sep 12 12:52:57 2019
New Revision: 511879
URL: https://svnweb.freebsd.org/changeset/ports/511879

Log:
  devel/android-tools-fastboot: update to 29.0.3
  
  Changes:        https://android.googlesource.com/platform/system/core/+log/android-9.0.0_r3..platform-tools-29.0.3/fastboot

Added:
  head/devel/android-tools-fastboot/files/patch-base_threads.cpp
     - copied unchanged from r511869, head/devel/android-tools-adb/files/patch-base_threads.cpp
  head/devel/android-tools-fastboot/files/patch-ext4__utils_ext4__utils.cpp
     - copied, changed from r477243, head/devel/android-tools-fastboot/files/patch-ext4__utils_ext4__utils.c
  head/devel/android-tools-fastboot/files/patch-fastboot_fastboot.cpp
     - copied, changed from r511869, head/devel/android-tools-adb/files/patch-adb_adb.cpp
  head/devel/android-tools-fastboot/files/patch-liblog_fake__writer.cpp
     - copied unchanged from r511869, head/devel/android-tools-adb/files/patch-liblog_fake__writer.cpp
  head/devel/android-tools-fastboot/files/patch-liblog_logger.h
     - copied unchanged from r511869, head/devel/android-tools-adb/files/patch-liblog_logger.h
  head/devel/android-tools-fastboot/files/patch-liblog_logger__write.cpp
     - copied unchanged from r511869, head/devel/android-tools-adb/files/patch-liblog_logger__write.cpp
  head/devel/android-tools-fastboot/files/patch-liblog_stderr__write.cpp
     - copied, changed from r511869, head/devel/android-tools-adb/files/patch-liblog_stderr__write.cpp
Deleted:
  head/devel/android-tools-fastboot/files/patch-adb_sysdeps.h
  head/devel/android-tools-fastboot/files/patch-base_errors__unix.cpp
  head/devel/android-tools-fastboot/files/patch-base_logging.cpp
  head/devel/android-tools-fastboot/files/patch-base_parsenetaddress.cpp
  head/devel/android-tools-fastboot/files/patch-liblog_logger__write.c
  head/devel/android-tools-fastboot/files/patch-libsparse_sparse__read.cpp
  head/devel/android-tools-fastboot/files/patch-libziparchive_zip__archive.cc
Modified:
  head/devel/android-tools-fastboot/Makefile
  head/devel/android-tools-fastboot/distinfo
  head/devel/android-tools-fastboot/files/Makefile
  head/devel/android-tools-fastboot/files/patch-base_file.cpp
  head/devel/android-tools-fastboot/files/patch-base_include_android-base_logging.h
  head/devel/android-tools-fastboot/files/usb_freebsd.cpp

Modified: head/devel/android-tools-fastboot/Makefile
==============================================================================
--- head/devel/android-tools-fastboot/Makefile	Thu Sep 12 12:49:46 2019	(r511878)
+++ head/devel/android-tools-fastboot/Makefile	Thu Sep 12 12:52:57 2019	(r511879)
@@ -1,9 +1,9 @@
 # $FreeBSD$
 
 PORTNAME=	android-tools-fastboot
-DISTVERSIONPREFIX=	android-
-DISTVERSION?=	9.0.0_r3
-PORTREVISION?=	3
+DISTVERSIONPREFIX=	platform-tools-
+DISTVERSION?=	29.0.3
+PORTREVISION?=	0
 CATEGORIES=	devel sysutils
 MASTER_SITES=	https://salsa.debian.org/android-tools-team/android-tools/raw/706e754/debian/:manpage
 DISTFILES=	fastboot.1:manpage
@@ -16,29 +16,25 @@ LICENSE=	APACHE20 BSD2CLAUSE
 LICENSE_COMB=	multi
 
 USE_GITHUB=	yes
-GH_ACCOUNT=	aosp-mirror jbeich:extras
-GH_PROJECT=	platform_system_core platform_system_extras:extras
+GH_ACCOUNT=	aosp-mirror jbeich:extras,mkbootimg
+GH_PROJECT=	platform_system_core platform_system_extras:extras \
+		platform_system_tools_mkbootimg:mkbootimg
 
 CONFLICTS_INSTALL?=	${PORTNAME}-devel-*
 
-USES=		compiler:c++11-lib pkgconfig uidfix
+USES=		compiler:c++17-lang pkgconfig ssl uidfix
 BUILD_WRKSRC=	${WRKSRC}/fastboot
 INSTALL_WRKSRC=	${BUILD_WRKSRC}
-CPPFLAGS+=	-D_GLIBCXX_USE_C99 # XXX ports/193528
 MAKEFILE?=	${.CURDIR}/files/Makefile
 MAKE_ENV=	BINDIR="${PREFIX}/bin" EXTRADIR="${FILESDIR}" \
 		FILESDIR="${DOCSDIR}" \
-		VERSION="${SDK_REVISION}-0 ${GH_REVISION}-android" \
+		VERSION="${DISTVERSION}${DISTVERSIONSUFFIX}" \
 		MANDIR="${PREFIX}/man/man"
 PLIST_FILES=	bin/fastboot \
 		man/man1/fastboot.1.gz
 PORTDOCS=	*
 SUB_FILES=	pkg-message
 
-# Generated by "make update-revision" for "fastboot --version"
-SDK_REVISION?=	28.0.0
-GH_REVISION=	${DISTVERSIONSUFFIX:U0fac9018f238:S/-g//}
-
 OPTIONS_DEFINE=	BASH DOCS
 OPTIONS_SUB=	yes
 
@@ -59,31 +55,11 @@ post-extract:
 		${BUILD_WRKSRC}
 # Adjust paths relative to core
 	@(cd ${WRKSRC_extras} && ${COPYTREE_SHARE} . ${WRKSRC})
+	@(cd ${WRKSRC_mkbootimg} && ${COPYTREE_SHARE} . ${WRKSRC})
 
 post-install-BASH-on:
 	${MKDIR} ${STAGEDIR}${PREFIX}/${BASH_PLIST_FILES:H}
 	${INSTALL_DATA} ${WRKSRC_bashcomp}/android \
 		${STAGEDIR}${PREFIX}/${BASH_PLIST_FILES}
 
-update-revision:
-	@${REINPLACE_CMD} -i '' -e "/^SDK_REVISION?=/s/=.*/=	$$(\
-		${FETCH_CMD} -qo- \
-			https://github.com/${GH_ACCOUNT}/platform_build/raw/${GH_TAGNAME}/core/version_defaults.mk | \
-			${SED} -n 's/^[[:space:]]*PLATFORM_SDK_VERSION := //p' \
-		).0.0/" \
-		${.CURDIR}/Makefile
-# https://developer.github.com/v3/repos/commits/#get-a-single-commit
-# Pretend to be curl(1) for pretty-printed JSON to help parse with sed(1)
-	@${REINPLACE_CMD} -i '' -e "/^GH_REVISION=/s/:U[^}:]*/:U$$(\
-		${SETENV} HTTP_USER_AGENT=curl ${FETCH_CMD} -qo- \
-			https://api.github.com/repos/${GH_ACCOUNT}/${GH_PROJECT}/commits/${GH_TAGNAME} | \
-			${SED} -n '/sha/ { s/.*\"\([0-9a-f]\{12\}\).*/\1/p; q; }' \
-		)/" \
-		${.CURDIR}/Makefile
-
 .include <bsd.port.mk>
-
-# XXX Work around !target(makesum)
-.ifndef DISTVERSIONSUFFIX
-makesum:	update-revision
-.endif

Modified: head/devel/android-tools-fastboot/distinfo
==============================================================================
--- head/devel/android-tools-fastboot/distinfo	Thu Sep 12 12:49:46 2019	(r511878)
+++ head/devel/android-tools-fastboot/distinfo	Thu Sep 12 12:52:57 2019	(r511879)
@@ -1,9 +1,11 @@
-TIMESTAMP = 1529542722
+TIMESTAMP = 1565662258
 SHA256 (fastboot.1) = 2af01b064440952a82f1602691a0fecc030302722a71444946fb70d9c423d283
 SIZE (fastboot.1) = 5906
-SHA256 (aosp-mirror-platform_system_core-android-9.0.0_r3_GH0.tar.gz) = b9de23465b304432aa2b585aa66c6bf4841b177f2139b75ca5adc5d917e0ecd6
-SIZE (aosp-mirror-platform_system_core-android-9.0.0_r3_GH0.tar.gz) = 27484684
-SHA256 (jbeich-platform_system_extras-android-9.0.0_r3_GH0.tar.gz) = d82c4576bed24bfe701bb8c781714fa70365c03aed93cf4777407215de4d672d
-SIZE (jbeich-platform_system_extras-android-9.0.0_r3_GH0.tar.gz) = 211722695
+SHA256 (aosp-mirror-platform_system_core-platform-tools-29.0.3_GH0.tar.gz) = f2938ab5d206f5d4e075afba1a3e32fc26656bb439b6208200bef0ea5bae77eb
+SIZE (aosp-mirror-platform_system_core-platform-tools-29.0.3_GH0.tar.gz) = 61252755
+SHA256 (jbeich-platform_system_extras-platform-tools-29.0.3_GH0.tar.gz) = 342433c834f260b5d55c5dc0b98ef27aea18feb50e1fff5e09fdb846c0f75a51
+SIZE (jbeich-platform_system_extras-platform-tools-29.0.3_GH0.tar.gz) = 210790583
+SHA256 (jbeich-platform_system_tools_mkbootimg-platform-tools-29.0.3_GH0.tar.gz) = 9c2f9ab0006969613a48b5a529674c0d79784b830479c28f802aa2a1916cdf53
+SIZE (jbeich-platform_system_tools_mkbootimg-platform-tools-29.0.3_GH0.tar.gz) = 6620
 SHA256 (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = ca3311ba47a5edd56c929ac9aae57c02c2c3f1636519c5f67abb00b6e3ecd75c
 SIZE (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = 5967

Modified: head/devel/android-tools-fastboot/files/Makefile
==============================================================================
--- head/devel/android-tools-fastboot/files/Makefile	Thu Sep 12 12:49:46 2019	(r511878)
+++ head/devel/android-tools-fastboot/files/Makefile	Thu Sep 12 12:52:57 2019	(r511879)
@@ -3,15 +3,14 @@
 PROG_CXX=fastboot
 BINDIR?=/usr/bin
 FILESDIR?=${DOCDIR}/${PROG}
-VERSION?=0.0.0-0
 
 FILES=	README.md
 
 SRCS+=	bootimg_utils.cpp
-SRCS+=	engine.cpp
 SRCS+=	fastboot.cpp
+SRCS+=	fastboot_driver.cpp
 SRCS+=	../fastboot/fs.cpp
-SRCS+=	protocol.cpp
+SRCS+=	main.cpp
 SRCS+=	socket.cpp
 SRCS+=	tcp.cpp
 SRCS+=	udp.cpp
@@ -20,20 +19,35 @@ SRCS+=	util.cpp
 .PATH: ${EXTRADIR}
 SRCS+=	usb_freebsd.cpp
 
-# required by fastboot
-.PATH: ${.CURDIR}/../adb
-SRCS+=	diagnose_usb.cpp
-
 # required by fastboot, diagnose_usb and libziparchive
 .PATH: ${.CURDIR}/../base
 SRCS+=	errors_unix.cpp
 SRCS+=	file.cpp
 SRCS+=	logging.cpp
+SRCS+=	mapped_file.cpp
 SRCS+=	parsenetaddress.cpp
 SRCS+=	stringprintf.cpp
 SRCS+=	strings.cpp
+SRCS+=	threads.cpp
 
 # required by fastboot
+.PATH: ${.CURDIR}/../diagnose_usb
+SRCS+=	diagnose_usb.cpp
+
+# required by fs_mgr/liblp
+.PATH: ${.CURDIR}/../ext4_utils
+SRCS+=	ext4_sb.cpp
+SRCS+=	ext4_utils.cpp
+
+# required by fastboot
+.PATH: ${.CURDIR}/../fs_mgr/liblp
+SRCS+=	images.cpp
+SRCS+=	partition_opener.cpp
+SRCS+=	reader.cpp
+SRCS+=	utility.cpp
+SRCS+=	writer.cpp
+
+# required by fastboot
 .PATH: ${.CURDIR}/../libcutils
 SRCS+=	android_get_control_file.cpp
 SRCS+=	../libcutils/sockets.cpp
@@ -45,36 +59,30 @@ CPPFLAGS.sockets.cpp+=	-o ${.TARGET}
 
 # required by base and libutils
 .PATH:	${.CURDIR}/../liblog
-SRCS+=	config_read.c
-SRCS+=	config_write.c
-SRCS+=	fake_log_device.c
-SRCS+=	fake_writer.c
-SRCS+=	local_logger.c
-SRCS+=	logger_lock.c
-SRCS+=	logger_name.c
-SRCS+=	logger_write.c
-SRCS+=	logprint.c
-SRCS+=	stderr_write.c
-SRCS+=	test_utils.cpp
+SRCS+=	config_read.cpp
+SRCS+=	config_write.cpp
+SRCS+=	fake_log_device.cpp
+SRCS+=	fake_writer.cpp
+SRCS+=	logger_lock.cpp
+SRCS+=	logger_name.cpp
+SRCS+=	logger_write.cpp
+SRCS+=	logprint.cpp
+SRCS+=	stderr_write.cpp
 
 # required by fastboot
 .PATH:	${.CURDIR}/../libsparse
-SRCS+=	backed_block.c
-SRCS+=	output_file.c
-SRCS+=	sparse.c
-SRCS+=	sparse_crc32.c
-SRCS+=	sparse_err.c
+SRCS+=	backed_block.cpp
+SRCS+=	output_file.cpp
+SRCS+=	sparse.cpp
+SRCS+=	sparse_crc32.cpp
+SRCS+=	sparse_err.cpp
 SRCS+=	sparse_read.cpp
 
-# required by libziparchive
-.PATH: ${.CURDIR}/../libutils
-SRCS+=	FileMap.cpp
-
 # required by fastboot
 .PATH:	${.CURDIR}/../libziparchive
 SRCS+=	zip_archive.cc
 
-CPPFLAGS+=	-DFASTBOOT_VERSION="\"${VERSION}\""
+CPPFLAGS+=	-DPLATFORM_TOOLS_VERSION="\"${VERSION:U0.0.0}\""
 CPPFLAGS+=	-Doff64_t=off_t
 CPPFLAGS+=	-Dftruncate64=ftruncate
 CPPFLAGS+=	-Dlseek64=lseek
@@ -83,21 +91,25 @@ CPPFLAGS+=	-Dpread64=pread
 CPPFLAGS+=	-DFAKE_LOG_DEVICE=1
 CPPFLAGS+=	-I${.CURDIR}
 CPPFLAGS+=	-I${.CURDIR}/../include
-CPPFLAGS+=	-I${.CURDIR}/../adb
-CPPFLAGS+=	-I${.CURDIR}/../mkbootimg/include/bootimg
+CPPFLAGS+=	-I${.CURDIR}/../include/bootimg
 CPPFLAGS+=	-I${.CURDIR}/../base/include
+CPPFLAGS+=	-I${.CURDIR}/../diagnose_usb/include
+CPPFLAGS+=	-I${.CURDIR}/../ext4_utils/include
+CPPFLAGS+=	-I${.CURDIR}/../fs_mgr/liblp/include
 CPPFLAGS+=	-I${.CURDIR}/../libsparse/include
 CPPFLAGS+=	-I${.CURDIR}/../libziparchive/include
 CPPFLAGS+=	${CPPFLAGS.${.IMPSRC:T}}
+CPPFLAGS+=	$$(${PKG_CONFIG} libcrypto --cflags 2>/dev/null)
 CPPFLAGS+=	$$(${PKG_CONFIG} libusb-1.0 --cflags 2>/dev/null)
 CXXFLAGS+=	-D__STDC_LIMIT_MACROS # DragonFly
-CXXFLAGS+=	-std=gnu++11
+CXXFLAGS+=	-std=gnu++17
 
 .ifndef COMPILE.c
 CFLAGS+=	${CPPFLAGS}
 CXXFLAGS+=	${CPPFLAGS}
 .endif
 
+LDADD+= $$(${PKG_CONFIG} libcrypto --libs 2>/dev/null || echo -lcrypto)
 LDADD+=	$$(${PKG_CONFIG} libusb-1.0 --libs 2>/dev/null || echo -lusb)
 LDADD+=	-lz \-lpthread
 DPADD+=	${LIBPTHREAD} ${LIBUSB} ${LIBZ}

Modified: head/devel/android-tools-fastboot/files/patch-base_file.cpp
==============================================================================
--- head/devel/android-tools-fastboot/files/patch-base_file.cpp	Thu Sep 12 12:49:46 2019	(r511878)
+++ head/devel/android-tools-fastboot/files/patch-base_file.cpp	Thu Sep 12 12:52:57 2019	(r511879)
@@ -1,17 +1,14 @@
---- base/file.cpp.orig	2017-06-20 10:50:27 UTC
+--- base/file.cpp.orig	2019-07-17 19:54:09 UTC
 +++ base/file.cpp
-@@ -19,6 +19,10 @@
- #include <errno.h>
+@@ -20,6 +20,7 @@
  #include <fcntl.h>
+ #include <ftw.h>
  #include <libgen.h>
-+#include <limits.h> // PATH_MAX
-+#include <stdio.h> // BUFSIZ
-+#include <stdlib.h> // realpath
-+#include <string.h> // strerror
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <unistd.h>
-@@ -36,6 +39,9 @@
++#include <limits.h> // PATH_MAX for GCC
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -35,6 +36,9 @@
  #if defined(__APPLE__)
  #include <mach-o/dyld.h>
  #endif
@@ -19,9 +16,9 @@
 +#include <sys/sysctl.h>
 +#endif
  #if defined(_WIN32)
+ #include <direct.h>
  #include <windows.h>
- #define O_CLOEXEC O_NOINHERIT
-@@ -251,6 +258,23 @@ std::string GetExecutablePath() {
+@@ -421,6 +425,23 @@ std::string GetExecutablePath() {
    if (result == 0 || result == sizeof(path) - 1) return "";
    path[PATH_MAX - 1] = 0;
    return path;

Modified: head/devel/android-tools-fastboot/files/patch-base_include_android-base_logging.h
==============================================================================
--- head/devel/android-tools-fastboot/files/patch-base_include_android-base_logging.h	Thu Sep 12 12:49:46 2019	(r511878)
+++ head/devel/android-tools-fastboot/files/patch-base_include_android-base_logging.h	Thu Sep 12 12:52:57 2019	(r511879)
@@ -1,11 +1,22 @@
---- base/include/android-base/logging.h.orig	2015-09-29 18:07:07 UTC
+--- base/include/android-base/logging.h.orig	2019-07-17 19:54:09 UTC
 +++ base/include/android-base/logging.h
-@@ -25,6 +25,8 @@
- #endif
- #endif
- 
-+#include <errno.h>
-+
- #include <functional>
- #include <memory>
- #include <ostream>
+@@ -350,7 +350,7 @@ struct LogAbortAfterFullExpr {
+ // DCHECKs are debug variants of CHECKs only enabled in debug builds. Generally
+ // CHECK should be used unless profiling identifies a CHECK as being in
+ // performance critical code.
+-#if defined(NDEBUG) && !defined(__clang_analyzer__)
++#if defined(NDEBUG) && !defined(__clang_analyzer__) || !defined(__ANDROID__)
+ static constexpr bool kEnableDChecks = false;
+ #else
+ static constexpr bool kEnableDChecks = true;
+@@ -486,8 +486,9 @@ namespace std {  // NOLINT(cert-dcl58-cpp)
+ #pragma clang diagnostic ignored "-Wgcc-compat"
+ #define OSTREAM_STRING_POINTER_USAGE_WARNING \
+     __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning")))
++OSTREAM_STRING_POINTER_USAGE_WARNING // GCC
+ inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer)
+-    OSTREAM_STRING_POINTER_USAGE_WARNING {
++{
+   return stream << static_cast<const void*>(string_pointer);
+ }
+ #pragma clang diagnostic pop

Copied: head/devel/android-tools-fastboot/files/patch-base_threads.cpp (from r511869, head/devel/android-tools-adb/files/patch-base_threads.cpp)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-fastboot/files/patch-base_threads.cpp	Thu Sep 12 12:52:57 2019	(r511879, copy of r511869, head/devel/android-tools-adb/files/patch-base_threads.cpp)
@@ -0,0 +1,36 @@
+--- base/threads.cpp.orig	2019-07-17 19:54:09 UTC
++++ base/threads.cpp
+@@ -25,6 +25,16 @@
+ #include <syscall.h>
+ #elif defined(_WIN32)
+ #include <windows.h>
++#elif defined(__DragonFly__) || defined(__FreeBSD__)
++#include <pthread_np.h>
++#elif defined(__NetBSD__)
++#include <lwp.h>
++#elif defined(__OpenBSD__)
++#include <unistd.h>
++#elif defined(__sun)
++#include <thread.h>
++#else // fallback
++#include <stdint.h>
+ #endif
+ 
+ namespace android {
+@@ -41,6 +51,16 @@ uint64_t GetThreadId() {
+   return syscall(__NR_gettid);
+ #elif defined(_WIN32)
+   return GetCurrentThreadId();
++#elif defined(__DragonFly__) || defined(__FreeBSD__)
++  return pthread_getthreadid_np();
++#elif defined(__NetBSD__)
++  return _lwp_self();
++#elif defined(__OpenBSD__)
++  return getthrid();
++#elif defined(__sun)
++  return thr_self();
++#else // fallback
++  return (intptr_t) pthread_self();
+ #endif
+ }
+ 

Copied and modified: head/devel/android-tools-fastboot/files/patch-ext4__utils_ext4__utils.cpp (from r477243, head/devel/android-tools-fastboot/files/patch-ext4__utils_ext4__utils.c)
==============================================================================
--- head/devel/android-tools-fastboot/files/patch-ext4__utils_ext4__utils.c	Wed Aug 15 17:30:38 2018	(r477243, copy source)
+++ head/devel/android-tools-fastboot/files/patch-ext4__utils_ext4__utils.cpp	Thu Sep 12 12:52:57 2019	(r511879)
@@ -1,6 +1,6 @@
---- ext4_utils/ext4_utils.c.orig	2012-12-18 23:27:26 UTC
-+++ ext4_utils/ext4_utils.c
-@@ -36,8 +36,16 @@
+--- ext4_utils/ext4_utils.cpp.orig	2019-08-13 02:10:50 UTC
++++ ext4_utils/ext4_utils.cpp
+@@ -32,8 +32,16 @@
  
  #if defined(__linux__)
  #include <linux/fs.h>
@@ -17,17 +17,8 @@
 +#include <sys/diskslice.h>
  #endif
  
- #include "ext4.h"
-@@ -53,6 +61,8 @@ struct sparse_file *ext4_sparse_file;
- jmp_buf setjmp_env;
- 
- /* Definition from RFC-4122 */
-+/* XXX <sys/uuid.h> defines slightly different |struct uuid| */
-+#define uuid ext4_uuid
- struct uuid {
-     u32 time_low;
-     u16 time_mid;
-@@ -383,10 +391,24 @@ static u64 get_block_device_size(int fd)
+ int force = 0;
+@@ -206,10 +214,24 @@ u64 get_block_device_size(int fd)
  	u64 size = 0;
  	int ret;
  

Copied and modified: head/devel/android-tools-fastboot/files/patch-fastboot_fastboot.cpp (from r511869, head/devel/android-tools-adb/files/patch-adb_adb.cpp)
==============================================================================
--- head/devel/android-tools-adb/files/patch-adb_adb.cpp	Thu Sep 12 10:14:54 2019	(r511869, copy source)
+++ head/devel/android-tools-fastboot/files/patch-fastboot_fastboot.cpp	Thu Sep 12 12:52:57 2019	(r511879)
@@ -1,9 +1,9 @@
---- adb/adb.cpp.orig	2019-07-17 19:54:09 UTC
-+++ adb/adb.cpp
-@@ -44,8 +44,19 @@
- #include <android-base/parsenetaddress.h>
+--- fastboot/fastboot.cpp.orig	2019-08-13 02:10:58 UTC
++++ fastboot/fastboot.cpp
+@@ -58,9 +58,20 @@
  #include <android-base/stringprintf.h>
  #include <android-base/strings.h>
+ #include <android-base/unique_fd.h>
 +#ifdef PLATFORM_TOOLS_VERSION
 +#include <sys/utsname.h>
 +namespace android { namespace build {
@@ -15,8 +15,10 @@
 +}}}
 +#else
  #include <build/version.h>
+-#include <liblp/liblp.h>
  #include <platform_tools_version.h>
 +#endif
++#include <liblp/liblp.h>
+ #include <sparse/sparse.h>
+ #include <ziparchive/zip_archive.h>
  
- #include "adb_auth.h"
- #include "adb_io.h"

Copied: head/devel/android-tools-fastboot/files/patch-liblog_fake__writer.cpp (from r511869, head/devel/android-tools-adb/files/patch-liblog_fake__writer.cpp)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-fastboot/files/patch-liblog_fake__writer.cpp	Thu Sep 12 12:52:57 2019	(r511879, copy of r511869, head/devel/android-tools-adb/files/patch-liblog_fake__writer.cpp)
@@ -0,0 +1,12 @@
+--- liblog/fake_writer.cpp.orig	2019-07-17 19:54:09 UTC
++++ liblog/fake_writer.cpp
+@@ -33,8 +33,8 @@ static int logFds[(int)LOG_ID_MAX] = {-1, -1, -1, -1, 
+ 
+ struct android_log_transport_write fakeLoggerWrite = {
+     .node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node},
+-    .context.priv = &logFds,
+     .name = "fake",
++    .context = { .priv = &logFds }, // GCC
+     .available = NULL,
+     .open = fakeOpen,
+     .close = fakeClose,

Copied: head/devel/android-tools-fastboot/files/patch-liblog_logger.h (from r511869, head/devel/android-tools-adb/files/patch-liblog_logger.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-fastboot/files/patch-liblog_logger.h	Thu Sep 12 12:52:57 2019	(r511879, copy of r511869, head/devel/android-tools-adb/files/patch-liblog_logger.h)
@@ -0,0 +1,16 @@
+--- liblog/logger.h.orig	2019-08-13 02:10:58 UTC
++++ liblog/logger.h
+@@ -16,7 +16,13 @@
+ 
+ #pragma once
+ 
++#ifdef __cplusplus
++#include <atomic>
++using std::atomic_int;
++using std::atomic_uintptr_t;
++#else
+ #include <stdatomic.h>
++#endif
+ 
+ #include <cutils/list.h>
+ #include <log/log.h>

Copied: head/devel/android-tools-fastboot/files/patch-liblog_logger__write.cpp (from r511869, head/devel/android-tools-adb/files/patch-liblog_logger__write.cpp)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-fastboot/files/patch-liblog_logger__write.cpp	Thu Sep 12 12:52:57 2019	(r511879, copy of r511869, head/devel/android-tools-adb/files/patch-liblog_logger__write.cpp)
@@ -0,0 +1,17 @@
+--- liblog/logger_write.cpp.orig	2019-07-17 19:54:09 UTC
++++ liblog/logger_write.cpp
+@@ -15,12 +15,12 @@
+  */
+ 
+ #include <errno.h>
+-#include <stdatomic.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/time.h>
+ 
+-#ifdef __BIONIC__
++#if defined(__ANDROID__)
++#include <stdatomic.h>
+ #include <android/set_abort_message.h>
+ #endif
+ 

Copied and modified: head/devel/android-tools-fastboot/files/patch-liblog_stderr__write.cpp (from r511869, head/devel/android-tools-adb/files/patch-liblog_stderr__write.cpp)
==============================================================================
--- head/devel/android-tools-adb/files/patch-liblog_stderr__write.cpp	Thu Sep 12 10:14:54 2019	(r511869, copy source)
+++ head/devel/android-tools-fastboot/files/patch-liblog_stderr__write.cpp	Thu Sep 12 12:52:57 2019	(r511879)
@@ -1,6 +1,6 @@
---- liblog/stderr_write.cpp.orig	2019-07-17 19:54:09 UTC
+--- liblog/stderr_write.cpp.orig	2019-08-13 02:10:58 UTC
 +++ liblog/stderr_write.cpp
-@@ -56,8 +56,8 @@ struct stderrContext {
+@@ -55,8 +55,8 @@ struct stderrContext {
  
  struct android_log_transport_write stderrLoggerWrite = {
      .node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node},

Modified: head/devel/android-tools-fastboot/files/usb_freebsd.cpp
==============================================================================
--- head/devel/android-tools-fastboot/files/usb_freebsd.cpp	Thu Sep 12 12:49:46 2019	(r511878)
+++ head/devel/android-tools-fastboot/files/usb_freebsd.cpp	Thu Sep 12 12:52:57 2019	(r511879)
@@ -42,18 +42,20 @@ struct usb_handle {
 	unsigned char iface;
 };
 
-class LibusbUsbTransport : public Transport {
+class LibusbUsbTransport : public UsbTransport {
 public:
-	explicit LibusbUsbTransport(std::unique_ptr<usb_handle> handle):
-		h(std::move(handle)) {}
-	~LibusbUsbTransport() override = default;
+	explicit LibusbUsbTransport(std::unique_ptr<usb_handle> handle, uint32_t ms_timeout):
+		h(std::move(handle)), ms_timeout_(ms_timeout) {}
+	~LibusbUsbTransport() override;
 
 	ssize_t Read(void *_data, size_t len) override;
 	ssize_t Write(const void *_data, size_t len) override;
 	int Close() override;
+	int Reset() override;
 
 private:
 	std::unique_ptr<usb_handle> h;
+	const uint32_t ms_timeout_;
 
 	DISALLOW_COPY_AND_ASSIGN(LibusbUsbTransport);
 };
@@ -174,7 +176,7 @@ LibusbUsbTransport::Write(const void *_data, size_t le
 	int actlen;
 
 	if (libusb_bulk_transfer(h->handle, h->ep_out,
-				 (unsigned char *)_data, len, &actlen, 0) < 0)
+				 (unsigned char *)_data, len, &actlen, ms_timeout_) < 0)
 		return (-1);
 	return (actlen);
 }
@@ -185,11 +187,16 @@ 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)
+				 (unsigned char *)_data, len, &actlen, ms_timeout_) < 0)
 		return (-1);
 	return (actlen);
 }
 
+LibusbUsbTransport::~LibusbUsbTransport()
+{
+	Close();
+}
+
 int
 LibusbUsbTransport::Close()
 {
@@ -200,9 +207,17 @@ LibusbUsbTransport::Close()
 	return (0);
 }
 
-Transport *
-usb_open(ifc_match_func callback)
+int
+LibusbUsbTransport::Reset()
 {
+	if (libusb_reset_device(h->handle))
+		return (-1);
+	return (0);
+}
+
+UsbTransport *
+usb_open(ifc_match_func callback, uint32_t timeout_ms)
+{
 	std::unique_ptr<usb_handle> h = enumerate(callback);
-	return (h ? new LibusbUsbTransport(std::move(h)) : nullptr);
+	return (h ? new LibusbUsbTransport(std::move(h), timeout_ms) : nullptr);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909121252.x8CCqvFE004351>