Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Dec 2015 01:55:45 +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: r403829 - in head/devel: android-tools-adb android-tools-adb-devel android-tools-adb-devel/files android-tools-adb/files android-tools-fastboot-devel android-tools-fastboot-devel/files
Message-ID:  <201512160155.tBG1tjCX091428@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Wed Dec 16 01:55:44 2015
New Revision: 403829
URL: https://svnweb.freebsd.org/changeset/ports/403829

Log:
  devel/android-tools-{adb,fastboot}-devel: update to m.p.5956
  
  Changes:	https://android.googlesource.com/platform/system/core/+log/0bb1ce06ea46..461a29540c01/adb
  Changes:	https://android.googlesource.com/platform/system/core/+log/0bb1ce06ea46..461a29540c01/fastboot

Added:
  head/devel/android-tools-adb-devel/files/patch-base_include_android-base_logging.h   (contents, props changed)
     - copied, changed from r403827, head/devel/android-tools-adb/files/patch-base_include_base_logging.h
  head/devel/android-tools-adb-devel/files/patch-base_logging.cpp   (contents, props changed)
  head/devel/android-tools-adb/files/extra-patch-base_include_base_logging.h   (contents, props changed)
     - copied, changed from r403827, head/devel/android-tools-adb/files/patch-base_include_base_logging.h
  head/devel/android-tools-fastboot-devel/files/pkg-message.in   (contents, props changed)
  head/devel/android-tools-fastboot-devel/files/usb_freebsd.cpp   (contents, props changed)
  head/devel/android-tools-fastboot-devel/files/util_freebsd.cpp   (contents, props changed)
Deleted:
  head/devel/android-tools-adb/files/patch-base_include_base_logging.h
Modified:
  head/devel/android-tools-adb-devel/Makefile   (contents, props changed)
  head/devel/android-tools-adb-devel/distinfo   (contents, props changed)
  head/devel/android-tools-adb-devel/files/Makefile   (contents, props changed)
  head/devel/android-tools-adb/Makefile   (contents, props changed)
  head/devel/android-tools-fastboot-devel/Makefile   (contents, props changed)
  head/devel/android-tools-fastboot-devel/distinfo   (contents, props changed)
  head/devel/android-tools-fastboot-devel/files/Makefile   (contents, props changed)

Modified: head/devel/android-tools-adb-devel/Makefile
==============================================================================
--- head/devel/android-tools-adb-devel/Makefile	Wed Dec 16 00:55:05 2015	(r403828)
+++ head/devel/android-tools-adb-devel/Makefile	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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"

Modified: head/devel/android-tools-adb-devel/distinfo
==============================================================================
--- head/devel/android-tools-adb-devel/distinfo	Wed Dec 16 00:55:05 2015	(r403828)
+++ head/devel/android-tools-adb-devel/distinfo	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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

Modified: head/devel/android-tools-adb-devel/files/Makefile
==============================================================================
--- head/devel/android-tools-adb-devel/files/Makefile	Wed Dec 16 00:55:05 2015	(r403828)
+++ head/devel/android-tools-adb-devel/files/Makefile	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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

Copied and modified: head/devel/android-tools-adb-devel/files/patch-base_include_android-base_logging.h (from r403827, head/devel/android-tools-adb/files/patch-base_include_base_logging.h)
==============================================================================
--- head/devel/android-tools-adb/files/patch-base_include_base_logging.h	Wed Dec 16 00:50:47 2015	(r403827, copy source)
+++ head/devel/android-tools-adb-devel/files/patch-base_include_android-base_logging.h	Wed Dec 16 01:55:44 2015	(r403829)
@@ -1,5 +1,5 @@
---- base/include/base/logging.h.orig	2015-09-29 18:07:07 UTC
-+++ base/include/base/logging.h
+--- 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

Added: head/devel/android-tools-adb-devel/files/patch-base_logging.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-adb-devel/files/patch-base_logging.cpp	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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
+ }
+ 

Modified: head/devel/android-tools-adb/Makefile
==============================================================================
--- head/devel/android-tools-adb/Makefile	Wed Dec 16 00:55:05 2015	(r403828)
+++ head/devel/android-tools-adb/Makefile	Wed Dec 16 01:55:44 2015	(r403829)
@@ -25,6 +25,7 @@ GH_REVISION=	f7f765fd62bf # generated by
 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
 

Copied and modified: head/devel/android-tools-adb/files/extra-patch-base_include_base_logging.h (from r403827, head/devel/android-tools-adb/files/patch-base_include_base_logging.h)
==============================================================================

Modified: head/devel/android-tools-fastboot-devel/Makefile
==============================================================================
--- head/devel/android-tools-fastboot-devel/Makefile	Wed Dec 16 00:55:05 2015	(r403828)
+++ head/devel/android-tools-fastboot-devel/Makefile	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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"

Modified: head/devel/android-tools-fastboot-devel/distinfo
==============================================================================
--- head/devel/android-tools-fastboot-devel/distinfo	Wed Dec 16 00:55:05 2015	(r403828)
+++ head/devel/android-tools-fastboot-devel/distinfo	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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

Modified: head/devel/android-tools-fastboot-devel/files/Makefile
==============================================================================
--- head/devel/android-tools-fastboot-devel/files/Makefile	Wed Dec 16 00:55:05 2015	(r403828)
+++ head/devel/android-tools-fastboot-devel/files/Makefile	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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

Added: head/devel/android-tools-fastboot-devel/files/pkg-message.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-fastboot-devel/files/pkg-message.in	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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

Added: head/devel/android-tools-fastboot-devel/files/usb_freebsd.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-fastboot-devel/files/usb_freebsd.cpp	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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);
+}

Added: head/devel/android-tools-fastboot-devel/files/util_freebsd.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-fastboot-devel/files/util_freebsd.cpp	Wed Dec 16 01:55:44 2015	(r403829)
@@ -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);
+}



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