Index: head/devel/android-tools-adb-devel/Makefile =================================================================== --- head/devel/android-tools-adb-devel/Makefile (revision 409355) +++ head/devel/android-tools-adb-devel/Makefile (revision 409356) @@ -1,30 +1,30 @@ # $FreeBSD$ # Hint: git describe --abbrev=12 --match android-m-preview -DISTVERSION= m-preview-6225 -DISTVERSIONSUFFIX= -gaef26bb1a4ad +DISTVERSION= m-preview-6425 +DISTVERSIONSUFFIX= -g0fc006685c20 PORTREVISION= 0 PKGNAMESUFFIX= -devel CONFLICTS_INSTALL= ${PORTNAME}-[0-9]* MASTERDIR= ${.CURDIR}/../android-tools-adb DISTINFO_FILE= ${.CURDIR}/distinfo FILESDIR= ${.CURDIR}/files EXTRA_PATCHES= ${.CURDIR}/files/patch-* 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].*//}-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 ${SETENV} PATH=${BUILD_WRKSRC}:${PATH} \ PYTHONPATH=${WRKSRC_development}/python-packages \ ${PYTHON_CMD} -m unittest discover -vs ${BUILD_WRKSRC} .include "${MASTERDIR}/Makefile" Index: head/devel/android-tools-adb-devel/distinfo =================================================================== --- head/devel/android-tools-adb-devel/distinfo (revision 409355) +++ head/devel/android-tools-adb-devel/distinfo (revision 409356) @@ -1,6 +1,6 @@ -SHA256 (android-platform_system_core-android-m-preview-6225-gaef26bb1a4ad_GH0.tar.gz) = be20282d07edffa0301a2ffa524169ec2f27ac99597ec88920343e820d38d824 -SIZE (android-platform_system_core-android-m-preview-6225-gaef26bb1a4ad_GH0.tar.gz) = 1470573 +SHA256 (android-platform_system_core-android-m-preview-6425-g0fc006685c20_GH0.tar.gz) = 96659d021fcabbddbf86ea2e834928352fd81a91d49cabea5d03f4c51c85889e +SIZE (android-platform_system_core-android-m-preview-6425-g0fc006685c20_GH0.tar.gz) = 1516347 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-2510-g72f24a0_GH0.tar.gz) = a7e3172a61be2b7545fb4c10d5516cceb68b574cf7c83b7fc00c5cac0527b182 SIZE (android-platform_development-android-m-preview-2510-g72f24a0_GH0.tar.gz) = 183871106 Index: head/devel/android-tools-adb-devel/files/patch-adb_adb__utils__test.cpp =================================================================== --- head/devel/android-tools-adb-devel/files/patch-adb_adb__utils__test.cpp (revision 409355) +++ head/devel/android-tools-adb-devel/files/patch-adb_adb__utils__test.cpp (nonexistent) @@ -1,11 +0,0 @@ ---- adb/adb_utils_test.cpp.orig 2015-11-07 17:05:12 UTC -+++ adb/adb_utils_test.cpp -@@ -194,7 +194,7 @@ TEST(adb_utils, parse_host_and_port) { - } - - void test_mkdirs(const std::string basepath) { -- EXPECT_TRUE(mkdirs(basepath)); -+ EXPECT_TRUE(mkdirs(adb_dirname(basepath))); - EXPECT_NE(-1, adb_creat(basepath.c_str(), 0600)); - EXPECT_FALSE(mkdirs(basepath + "/subdir/")); - } Property changes on: head/devel/android-tools-adb-devel/files/patch-adb_adb__utils__test.cpp ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/android-tools-adb-devel/files/Makefile =================================================================== --- head/devel/android-tools-adb-devel/files/Makefile (revision 409355) +++ head/devel/android-tools-adb-devel/files/Makefile (revision 409356) @@ -1,125 +1,125 @@ # $FreeBSD$ PROG_CXX=adb NO_MAN= BINDIR?=/usr/bin FILESDIR?=${DOCDIR}/${PROG} FILES= *.[Tt][Xx][Tt] SRCS+= adb.cpp SRCS+= adb_auth.cpp SRCS+= adb_auth_host.cpp SRCS+= adb_client.cpp SRCS+= adb_io.cpp SRCS+= adb_listeners.cpp 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 SRCS+= services.cpp SRCS+= shell_service_protocol.cpp -# XXX SuffFindDeps may fail to restore suffix lost in transformation SRCS+= ../adb/sockets.cpp SRCS+= transport.cpp SRCS+= transport_local.cpp SRCS+= transport_usb.cpp TEST_SRCS+= adb_io_test.cpp TEST_SRCS+= adb_utils_test.cpp TEST_SRCS+= fdevent_test.cpp TEST_SRCS+= shell_service_protocol_test.cpp TEST_SRCS+= socket_test.cpp +TEST_SRCS+= sysdeps_test.cpp TEST_SRCS+= transport_test.cpp .PATH: ${.CURDIR}/client SRCS+= main.cpp .PATH: ${EXTRADIR} SRCS+= get_my_path_freebsd.cpp SRCS+= usb_libusb.cpp .PATH: ${.CURDIR}/../base SRCS+= file.cpp SRCS+= logging.cpp SRCS+= parsenetaddress.cpp SRCS+= stringprintf.cpp SRCS+= strings.cpp TEST_SRCS+= file_test.cpp TEST_SRCS+= logging_test.cpp TEST_SRCS+= parsenetaddress_test.cpp TEST_SRCS+= stringprintf_test.cpp TEST_SRCS+= strings_test.cpp TEST_SRCS+= test_main.cpp TEST_SRCS+= test_utils.cpp .PATH: ${.CURDIR}/../libcutils SRCS+= socket_inaddr_any_server_unix.c SRCS+= socket_local_client_unix.c SRCS+= socket_local_server_unix.c SRCS+= socket_loopback_client_unix.c SRCS+= socket_loopback_server_unix.c SRCS+= socket_network_client_unix.c SRCS+= load_file.c SRCS+= threads.c # required by base/file.cpp .PATH: ${.CURDIR}/../liblog SRCS+= fake_log_device.c SRCS+= logd_write.c CPPFLAGS.logd_write.c+= -DFAKE_LOG_DEVICE=1 REVISION?= $$(${GIT} rev-parse --short=12 HEAD 2>/dev/null || echo unknown) CPPFLAGS+= -DADB_REVISION="\"${REVISION}-android\"" CPPFLAGS+= -DADB_HOST=1 CPPFLAGS+= -DHAVE_FORKEXEC=1 CPPFLAGS+= -DHAVE_SYMLINKS CPPFLAGS+= -DHAVE_TERMIO_H CPPFLAGS+= -DHAVE_SYS_SOCKET_H CPPFLAGS+= -D_FILE_OFFSET_BITS=64 CPPFLAGS+= -I${.CURDIR} CPPFLAGS+= -I${.CURDIR}/../include CPPFLAGS+= -I${.CURDIR}/../base/include CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}} CPPFLAGS+= $$(${PKG_CONFIG} libcrypto --cflags 2>/dev/null) CPPFLAGS+= $$(${PKG_CONFIG} libusb-1.0 --cflags 2>/dev/null) CXXFLAGS+= -std=gnu++11 .ifndef COMPILE.c CFLAGS+= ${CPPFLAGS} CXXFLAGS+= ${CPPFLAGS} .endif TEST_CPPFLAGS+= $$(${GTEST_CONFIG} --cppflags) .for f in ${TEST_SRCS} CPPFLAGS.${f}+= ${TEST_CPPFLAGS} .endfor 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+= ${LIBCRYPTO} ${LIBPTHREAD} ${LIBUSB} ${LIBZ} TEST_LDADD+= $$(${GTEST_CONFIG} --libs --ldflags) TEST_OBJS+= ${TEST_SRCS:R:S/$/.o/} CLEANFILES+= ${PROG}_test ${TEST_OBJS} GIT?= git GTEST_CONFIG?= gtest-config PKG_CONFIG?= pkg-config beforeinstall: ${INSTALL} -d ${DESTDIR}${FILESDIR} .include test: ${PROG}_test @for f in ${.ALLSRC}; do ./$$f; done ${PROG}_test: ${OBJS:Nmain.o:Ncommandline.o} ${TEST_OBJS} ${CXX} ${CPPFLAGS} ${CXXFLAGS} ${LDFLAGS} -o $@ $> ${LDADD} ${TEST_LDADD} Index: head/devel/android-tools-adb-devel/files/patch-adb_sysdeps.h =================================================================== --- head/devel/android-tools-adb-devel/files/patch-adb_sysdeps.h (revision 409355) +++ head/devel/android-tools-adb-devel/files/patch-adb_sysdeps.h (revision 409356) @@ -1,27 +1,43 @@ --- adb/sysdeps.h.orig 2015-09-05 00:01:27 UTC +++ adb/sysdeps.h +@@ -61,11 +61,13 @@ + #endif + #endif + +-#ifdef _WIN32 +- ++#if !defined(__clang__) || __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 7) + // Clang-only nullability specifiers + #define _Nonnull + #define _Nullable ++#endif ++ ++#ifdef _WIN32 + + #include + #include @@ -401,6 +401,11 @@ typedef std::unique_ptr +#if defined(__Bitrig__) || defined(__DragonFly__) || \ + defined(__FreeBSD__) || defined(__OpenBSD__) +#include +#endif + #define OS_PATH_SEPARATORS "/" #define OS_PATH_SEPARATOR '/' #define OS_PATH_SEPARATOR_STR "/" @@ -627,6 +632,12 @@ static __inline__ bool adb_thread_create static __inline__ int adb_thread_setname(const std::string& name) { #ifdef __APPLE__ return pthread_setname_np(name.c_str()); +#elif defined(__Bitrig__) || defined(__DragonFly__) || \ + defined(__FreeBSD__) || defined(__OpenBSD__) + pthread_set_name_np(pthread_self(), name.c_str()); + return 0; +#elif defined(__NetBSD__) + return pthread_setname_np(pthread_self(), "%s", (void*)name.c_str()); #else const char *s = name.c_str(); Index: head/devel/android-tools-adb-devel/files/patch-base_parsenetaddress.cpp =================================================================== --- head/devel/android-tools-adb-devel/files/patch-base_parsenetaddress.cpp (nonexistent) +++ head/devel/android-tools-adb-devel/files/patch-base_parsenetaddress.cpp (revision 409356) @@ -0,0 +1,10 @@ +--- base/parsenetaddress.cpp.orig 2016-02-20 02:39:51 UTC ++++ base/parsenetaddress.cpp +@@ -16,6 +16,7 @@ + + #include "android-base/parsenetaddress.h" + ++#include // sscanf + #include + + #include "android-base/stringprintf.h" Property changes on: head/devel/android-tools-adb-devel/files/patch-base_parsenetaddress.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/android-tools-adb-devel/files/usb_libusb.cpp =================================================================== --- head/devel/android-tools-adb-devel/files/usb_libusb.cpp (revision 409355) +++ head/devel/android-tools-adb-devel/files/usb_libusb.cpp (revision 409356) @@ -1,656 +1,653 @@ /* * Copyright (C) 2009 bsdroid project * Alexey Tarasov * * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define TRACE_TAG USB #include "sysdeps.h" #include #include #include #include #include #include #include "adb.h" #include "transport.h" ADB_MUTEX_DEFINE( usb_lock ); static libusb_context *ctx = NULL; struct usb_handle { usb_handle *prev; usb_handle *next; libusb_device *dev; libusb_device_handle *devh; int interface; uint8_t dev_bus; uint8_t dev_addr; int zero_mask; unsigned char end_point_address[2]; char serial[128]; adb_cond_t notify; adb_mutex_t lock; }; static usb_handle handle_list = { .prev = &handle_list, .next = &handle_list, }; static void usb_cleanup() { libusb_exit(ctx); } static void report_bulk_libusb_error(int r) { switch (r) { case LIBUSB_ERROR_TIMEOUT: D("Transfer timeout"); break; case LIBUSB_ERROR_PIPE: D("Control request is not supported"); break; case LIBUSB_ERROR_OVERFLOW: D("Device offered more data"); break; case LIBUSB_ERROR_NO_DEVICE : D("Device was disconnected"); break; default: D("Error %d during transfer", r); break; }; } static int usb_bulk_write(usb_handle *uh, const void *data, int len) { int r = 0; int transferred = 0; r = libusb_bulk_transfer(uh->devh, uh->end_point_address[1], (unsigned char *)data, len, &transferred, 0); if (r != 0) { D("usb_bulk_write(): "); report_bulk_libusb_error(r); return r; } return (transferred); } static int usb_bulk_read(usb_handle *uh, void *data, int len) { int r = 0; int transferred = 0; r = libusb_bulk_transfer(uh->devh, uh->end_point_address[0], (unsigned char *)data, len, &transferred, 0); if (r != 0) { D("usb_bulk_read(): "); report_bulk_libusb_error(r); return r; } return (transferred); } int usb_write(usb_handle *uh, const void *_data, int len) { unsigned char *data = (unsigned char*) _data; int n; int need_zero = 0; if (uh->zero_mask == 1) { if (!(len & uh->zero_mask)) { need_zero = 1; } } D("usb_write(): %p:%d -> transport %p", _data, len, uh); while (len > 0) { int xfer = (len > 4096) ? 4096 : len; n = usb_bulk_write(uh, data, xfer); if (n != xfer) { D("usb_write(): failed for transport %p (%d bytes left)", uh, len); return -1; } len -= xfer; data += xfer; } if (need_zero){ n = usb_bulk_write(uh, _data, 0); if (n < 0) { D("usb_write(): failed to finish operation for transport %p", uh); } return n; } return 0; } int usb_read(usb_handle *uh, void *_data, int len) { unsigned char *data = (unsigned char*)_data; int n; D("usb_read(): %p:%d <- transport %p", _data, len, uh); while (len > 0) { int xfer = (len > 4096) ? 4096 : len; n = usb_bulk_read(uh, data, xfer); if (n != xfer) { if (n > 0) { data += n; len -= n; continue; } D("usb_read(): failed for transport %p (%d bytes left)", uh, len); return -1; } len -= xfer; data += xfer; } return 0; } int usb_close(usb_handle *h) { D("usb_close(): closing transport %p", h); adb_mutex_lock(&usb_lock); h->next->prev = h->prev; h->prev->next = h->next; h->prev = NULL; h->next = NULL; libusb_release_interface(h->devh, h->interface); libusb_close(h->devh); libusb_unref_device(h->dev); adb_mutex_unlock(&usb_lock); free(h); return (0); } void usb_kick(usb_handle *h) { D("usb_kick(): kicking transport %p", h); adb_mutex_lock(&h->lock); unregister_usb_transport(h); adb_mutex_unlock(&h->lock); h->next->prev = h->prev; h->prev->next = h->next; h->prev = NULL; h->next = NULL; libusb_release_interface(h->devh, h->interface); libusb_close(h->devh); libusb_unref_device(h->dev); free(h); } static int check_usb_interface(libusb_interface const *interface, libusb_device_descriptor const *desc, usb_handle *uh) { int e; if (interface->num_altsetting == 0) { D("check_usb_interface(): No interface settings"); return -1; } libusb_interface_descriptor const *idesc = &interface->altsetting[0]; if (idesc->bNumEndpoints != 2) { D("check_usb_interface(): Interface have not 2 endpoints, ignoring"); return -1; } for (e = 0; e < idesc->bNumEndpoints; e++) { libusb_endpoint_descriptor const *edesc = &idesc->endpoint[e]; if (edesc->bmAttributes != LIBUSB_TRANSFER_TYPE_BULK) { D("check_usb_interface(): Endpoint (%u) is not bulk (%u), ignoring", edesc->bmAttributes, LIBUSB_TRANSFER_TYPE_BULK); return -1; } if (edesc->bEndpointAddress & LIBUSB_ENDPOINT_IN) uh->end_point_address[0] = edesc->bEndpointAddress; else uh->end_point_address[1] = edesc->bEndpointAddress; /* aproto 01 needs 0 termination */ if (idesc->bInterfaceProtocol == 0x01) { uh->zero_mask = edesc->wMaxPacketSize - 1; D("check_usb_interface(): Forced Android interface protocol v.1"); } } D("check_usb_interface(): Device: %04x:%04x " "iclass: %x, isclass: %x, iproto: %x ep: %x/%x-> ", desc->idVendor, desc->idProduct, idesc->bInterfaceClass, idesc->bInterfaceSubClass, idesc->bInterfaceProtocol, uh->end_point_address[0], uh->end_point_address[1]); if (!is_adb_interface(desc->idVendor, desc->idProduct, idesc->bInterfaceClass, idesc->bInterfaceSubClass, idesc->bInterfaceProtocol)) { D("not matches"); return -1; } D("matches"); return 1; } static int check_usb_interfaces(libusb_config_descriptor *config, libusb_device_descriptor *desc, usb_handle *uh) { int i; for (i = 0; i < config->bNumInterfaces; ++i) { if (check_usb_interface(&config->interface[i], desc, uh) != -1) { /* found some interface and saved information about it */ D("check_usb_interfaces(): Interface %d of %04x:%04x " "matches Android device", i, desc->idVendor, desc->idProduct); return i; } } return -1; } static int register_device(usb_handle *uh, const char *serial) { D("register_device(): Registering %p [%s] as USB transport", uh, serial); usb_handle* usb = reinterpret_cast(calloc(1, sizeof(usb_handle))); if (usb == nullptr) fatal("couldn't allocate usb_handle"); memcpy(usb, uh, sizeof(usb_handle)); strcpy(usb->serial, uh->serial); adb_cond_init(&usb->notify, 0); adb_mutex_init(&usb->lock, 0); adb_mutex_lock(&usb_lock); usb->next = &handle_list; usb->prev = handle_list.prev; usb->prev->next = usb; usb->next->prev = usb; adb_mutex_unlock(&usb_lock); char devpath[64]; snprintf(devpath, sizeof(devpath), "ugen%d.%d", uh->dev_bus, uh->dev_addr); register_usb_transport(usb, serial, devpath, 1); return (1); } static int already_registered(usb_handle *uh) { usb_handle *usb = NULL; int exists = 0; adb_mutex_lock(&usb_lock); for (usb = handle_list.next; usb != &handle_list; usb = usb->next) { if ((usb->dev_bus == uh->dev_bus) && (usb->dev_addr == uh->dev_addr)) { exists = 1; break; } } adb_mutex_unlock(&usb_lock); return exists; } static void check_device(libusb_device *dev) { usb_handle uh; int i = 0; int found = -1; char serial[256] = {0}; libusb_device_descriptor desc; libusb_config_descriptor *config = NULL; int r = libusb_get_device_descriptor(dev, &desc); if (r != LIBUSB_SUCCESS) { D("check_device(): Failed to get device descriptor"); return; } if ((desc.idVendor == 0) && (desc.idProduct == 0)) return; D("check_device(): Probing usb device %04x:%04x", desc.idVendor, desc.idProduct); if (!is_adb_interface(desc.idVendor, desc.idProduct, ADB_CLASS, ADB_SUBCLASS, ADB_PROTOCOL)) { D("check_device(): Ignored due unknown vendor id"); return; } uh.dev_bus = libusb_get_bus_number(dev); uh.dev_addr = libusb_get_device_address(dev); if (already_registered(&uh)) { D("check_device(): Device (bus: %d, address: %d) " "is already registered", uh.dev_bus, uh.dev_addr); return; } D("check_device(): Device bus: %d, address: %d", uh.dev_bus, uh.dev_addr); r = libusb_get_active_config_descriptor(dev, &config); if (r != 0) { if (r == LIBUSB_ERROR_NOT_FOUND) { D("check_device(): Device %4x:%4x is unconfigured", desc.idVendor, desc.idProduct); return; } D("check_device(): Failed to get configuration for %4x:%4x", desc.idVendor, desc.idProduct); return; } if (config == NULL) { D("check_device(): Sanity check failed after " "getting active config"); return; } if (config->interface != NULL) { found = check_usb_interfaces(config, &desc, &uh); } /* not needed anymore */ libusb_free_config_descriptor(config); r = libusb_open(dev, &uh.devh); uh.dev = dev; if (r != 0) { switch (r) { case LIBUSB_ERROR_NO_MEM: D("check_device(): Memory allocation problem"); break; case LIBUSB_ERROR_ACCESS: D("check_device(): Permissions problem, " "current user priveleges are messed up?"); break; case LIBUSB_ERROR_NO_DEVICE: D("check_device(): Device disconected, bad cable?"); break; default: D("check_device(): libusb triggered error %d", r); } // skip rest found = -1; } if (found >= 0) { D("check_device(): Device matches Android interface"); // read the device's serial number memset(serial, 0, sizeof(serial)); uh.interface = found; r = libusb_claim_interface(uh.devh, uh.interface); if (r < 0) { D("check_device(): Failed to claim interface %d", uh.interface); goto fail; } if (desc.iSerialNumber) { // reading serial uint16_t buffer[128] = {0}; uint16_t languages[128] = {0}; int languageCount = 0; memset(languages, 0, sizeof(languages)); r = libusb_control_transfer(uh.devh, LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, LIBUSB_REQUEST_GET_DESCRIPTOR, LIBUSB_DT_STRING << 8, 0, (uint8_t *)languages, sizeof(languages), 0); if (r <= 0) { D("check_device(): Failed to get languages count"); goto fail; } languageCount = (r - 2) / 2; for (i = 1; i <= languageCount; ++i) { memset(buffer, 0, sizeof(buffer)); r = libusb_control_transfer(uh.devh, LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | desc.iSerialNumber, languages[i], (uint8_t *)buffer, sizeof(buffer), 0); if (r > 0) { /* converting serial */ int j = 0; r /= 2; for (j = 1; j < r; ++j) serial[j - 1] = buffer[j]; serial[j - 1] = '\0'; break; /* languagesCount cycle */ } } if (register_device(&uh, serial) == 0) { D("check_device(): Failed to register device"); goto fail_interface; } libusb_ref_device(dev); } } return; fail_interface: libusb_release_interface(uh.devh, uh.interface); fail: libusb_close(uh.devh); uh.devh = NULL; } static int check_device_connected(usb_handle *uh) { int r = libusb_kernel_driver_active(uh->devh, uh->interface); if (r == LIBUSB_ERROR_NO_DEVICE) return 0; if (r < 0) return -1; return 1; } static void kick_disconnected() { usb_handle *usb = NULL; adb_mutex_lock(&usb_lock); for (usb = handle_list.next; usb != &handle_list; usb = usb->next) { if (check_device_connected(usb) == 0) { D("kick_disconnected(): Transport %p is not online anymore", usb); usb_kick(usb); } } adb_mutex_unlock(&usb_lock); } static void scan_usb_devices() { D("scan_usb_devices(): started"); libusb_device **devs= NULL; libusb_device *dev= NULL; ssize_t cnt = libusb_get_device_list(ctx, &devs); if (cnt < 0) { D("scan_usb_devices(): Failed to get device list (error: %zd)", cnt); return; } int i = 0; while ((dev = devs[i++]) != NULL) { check_device(dev); } libusb_free_device_list(devs, 1); } -static void * -device_poll_thread(void* unused) +static void +device_poll_thread(void*) { adb_thread_setname("USB scan"); D("device_poll_thread(): Created USB scan thread"); for (;;) { sleep(5); kick_disconnected(); scan_usb_devices(); } - - /* never reaching this point */ - return (NULL); } static void sigalrm_handler(int signo) { /* nothing */ } void usb_init() { D("usb_init(): started"); struct sigaction actions; atexit(usb_cleanup); int r = libusb_init(&ctx); if (r != LIBUSB_SUCCESS) { fatal_errno("Failed to init libusb"); } memset(&actions, 0, sizeof(actions)); sigemptyset(&actions.sa_mask); actions.sa_flags = 0; actions.sa_handler = sigalrm_handler; sigaction(SIGALRM, &actions, NULL); /* initial device scan */ scan_usb_devices(); /* starting USB event polling thread */ if (!adb_thread_create(device_poll_thread, nullptr)) { fatal_errno("cannot create USB scan thread"); } D("usb_init(): finished"); } Index: head/devel/android-tools-fastboot-devel/Makefile =================================================================== --- head/devel/android-tools-fastboot-devel/Makefile (revision 409355) +++ head/devel/android-tools-fastboot-devel/Makefile (revision 409356) @@ -1,18 +1,19 @@ # $FreeBSD$ # Hint: git describe --abbrev=12 --match android-m-preview -DISTVERSION= m-preview-6225 -DISTVERSIONSUFFIX= -gaef26bb1a4ad +DISTVERSION= m-preview-6425 +DISTVERSIONSUFFIX= -g0fc006685c20 PORTREVISION= 0 PKGNAMESUFFIX= -devel -GH_TAGNAME= ${DISTVERSIONFULL:C/-[0-9].*//}-1153-gb764f45:extras \ - ${DISTVERSIONFULL:C/-[0-9].*//}-96-g589c5ac:libselinux +GH_TAGNAME= ${DISTVERSIONFULL:C/-[0-9].*//}-1197-g21ac023:extras \ + ${DISTVERSIONFULL:C/-[0-9].*//}-98-gde7b594:libselinux CONFLICTS_INSTALL= ${PORTNAME}-[0-9]* MASTERDIR= ${.CURDIR}/../android-tools-fastboot -FILESDIR= ${.CURDIR}/files DISTINFO_FILE= ${.CURDIR}/distinfo +FILESDIR= ${.CURDIR}/files +EXTRA_PATCHES= ${.CURDIR}/files/patch-* .include "${MASTERDIR}/Makefile" Index: head/devel/android-tools-fastboot-devel/distinfo =================================================================== --- head/devel/android-tools-fastboot-devel/distinfo (revision 409355) +++ head/devel/android-tools-fastboot-devel/distinfo (revision 409356) @@ -1,10 +1,10 @@ SHA256 (fastboot.1?id=706e754) = 2af01b064440952a82f1602691a0fecc030302722a71444946fb70d9c423d283 SIZE (fastboot.1?id=706e754) = 5906 -SHA256 (android-platform_system_core-android-m-preview-6225-gaef26bb1a4ad_GH0.tar.gz) = be20282d07edffa0301a2ffa524169ec2f27ac99597ec88920343e820d38d824 -SIZE (android-platform_system_core-android-m-preview-6225-gaef26bb1a4ad_GH0.tar.gz) = 1470573 -SHA256 (jbeich-platform_system_extras-android-m-preview-1153-gb764f45_GH0.tar.gz) = c890a16360c65b126d73736382085e858c7135e7fec918a18aea1c0d29a9deac -SIZE (jbeich-platform_system_extras-android-m-preview-1153-gb764f45_GH0.tar.gz) = 76537274 -SHA256 (jbeich-platform_external_libselinux-android-m-preview-96-g589c5ac_GH0.tar.gz) = 6c8bd5123ff5e2f1110ee70cda5d3f396c128c3f92bff71035676fc12c48f81b -SIZE (jbeich-platform_external_libselinux-android-m-preview-96-g589c5ac_GH0.tar.gz) = 59097 +SHA256 (android-platform_system_core-android-m-preview-6425-g0fc006685c20_GH0.tar.gz) = 96659d021fcabbddbf86ea2e834928352fd81a91d49cabea5d03f4c51c85889e +SIZE (android-platform_system_core-android-m-preview-6425-g0fc006685c20_GH0.tar.gz) = 1516347 +SHA256 (jbeich-platform_system_extras-android-m-preview-1197-g21ac023_GH0.tar.gz) = bf6df99267b76e7a3446f3d4d613bbb1493b3ba43ab87aca99f0ade9d2990163 +SIZE (jbeich-platform_system_extras-android-m-preview-1197-g21ac023_GH0.tar.gz) = 76589937 +SHA256 (jbeich-platform_external_libselinux-android-m-preview-98-gde7b594_GH0.tar.gz) = 6ce79ee148103a59ed16e49fd3b9af80e84e65ec4a4ab0a883c14befd6cc29b6 +SIZE (jbeich-platform_external_libselinux-android-m-preview-98-gde7b594_GH0.tar.gz) = 59433 SHA256 (mbrubeck-android-completion-3b0fabe_GH0.tar.gz) = dc774f101acd9514baf3e7a0ac610068116f2c093b94987ba59203a39a6439dc SIZE (mbrubeck-android-completion-3b0fabe_GH0.tar.gz) = 5948 Index: head/devel/android-tools-fastboot-devel/files/Makefile =================================================================== --- head/devel/android-tools-fastboot-devel/files/Makefile (revision 409355) +++ head/devel/android-tools-fastboot-devel/files/Makefile (revision 409356) @@ -1,118 +1,131 @@ # $FreeBSD$ PROG_CXX=fastboot BINDIR?=/usr/bin FILESDIR?=${DOCDIR}/${PROG} FILES= *.[Tt][Xx][Tt] SRCS+= bootimg_utils.cpp SRCS+= engine.cpp SRCS+= fastboot.cpp SRCS+= fs.cpp SRCS+= protocol.cpp +SRCS+= socket.cpp +SRCS+= tcp.cpp +SRCS+= udp.cpp SRCS+= util.cpp .PATH: ${EXTRADIR} SRCS+= usb_freebsd.cpp SRCS+= util_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+= strings.cpp +SRCS+= parsenetaddress.cpp SRCS+= stringprintf.cpp +SRCS+= strings.cpp # required by fastboot .PATH: ${.CURDIR}/../ext4_utils SRCS+= allocate.c SRCS+= contents.c SRCS+= crc16.c SRCS+= ext4_sb.c SRCS+= ext4_utils.c SRCS+= ext4fixup.c SRCS+= extent.c SRCS+= indirect.c SRCS+= make_ext4fs.c SRCS+= sha1.c SRCS+= wipe.c + +# required by fastboot +.PATH: ${.CURDIR}/../libcutils +SRCS+= ../libcutils/sockets.cpp +SRCS+= socket_inaddr_any_server_unix.c +SRCS+= socket_network_client_unix.c +SRCS+= sockets_unix.cpp +CPPFLAGS.sockets.cpp+= -o ${.TARGET} # XXX pre-r279980 # required by base and libutils .PATH: ${.CURDIR}/../liblog SRCS+= fake_log_device.c SRCS+= logd_write.c CPPFLAGS.logd_write.c+= -DFAKE_LOG_DEVICE=1 # required by ext4_utils .PATH: ${.CURDIR}/../libselinux/src SRCS+= callbacks.c SRCS+= check_context.c SRCS+= freecon.c SRCS+= init.c SRCS+= label.c SRCS+= label_android_property.c SRCS+= label_file.c SRCS+= label_support.c CPPFLAGS.label_file.c+= -D_WITH_GETLINE # required by fastboot and ext4_utils .PATH: ${.CURDIR}/../libsparse SRCS+= backed_block.c SRCS+= output_file.c SRCS+= sparse.c SRCS+= sparse_crc32.c SRCS+= sparse_err.c SRCS+= sparse_read.c # required by libziparchive .PATH: ${.CURDIR}/../libutils SRCS+= FileMap.cpp # required by fastboot .PATH: ${.CURDIR}/../libziparchive SRCS+= zip_archive.cc REVISION?= $$(${GIT} rev-parse --short=12 HEAD 2>/dev/null || echo unknown) CPPFLAGS+= -DFASTBOOT_REVISION="\"${REVISION}-android\"" CPPFLAGS+= -Doff64_t=off_t CPPFLAGS+= -Dftruncate64=ftruncate CPPFLAGS+= -Dlseek64=lseek 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 CPPFLAGS+= -I${.CURDIR}/../f2fs_utils CPPFLAGS+= -I${.CURDIR}/../libselinux/include CPPFLAGS+= -I${.CURDIR}/../libsparse/include CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}} CPPFLAGS+= $$(${PKG_CONFIG} libpcre --cflags 2>/dev/null) CPPFLAGS+= $$(${PKG_CONFIG} libusb-1.0 --cflags 2>/dev/null) CXXFLAGS+= -D__STDC_LIMIT_MACROS # DragonFly CXXFLAGS+= -std=gnu++11 .ifndef COMPILE.c CFLAGS+= ${CPPFLAGS} CXXFLAGS+= ${CPPFLAGS} .endif LDADD+= $$(${PKG_CONFIG} libpcre --libs 2>/dev/null || echo -lpcre) LDADD+= $$(${PKG_CONFIG} libusb-1.0 --libs 2>/dev/null || echo -lusb) LDADD+= -lz DPADD+= ${LIBPCRE} ${LIBUSB} ${LIBZ} GIT?= git PKG_CONFIG?= pkg-config beforeinstall: ${INSTALL} -d ${DESTDIR}${FILESDIR} .include Index: head/devel/android-tools-fastboot-devel/files/patch-adb_sysdeps.h =================================================================== --- head/devel/android-tools-fastboot-devel/files/patch-adb_sysdeps.h (nonexistent) +++ head/devel/android-tools-fastboot-devel/files/patch-adb_sysdeps.h (revision 409356) @@ -0,0 +1,43 @@ +--- adb/sysdeps.h.orig 2015-09-05 00:01:27 UTC ++++ adb/sysdeps.h +@@ -61,11 +61,13 @@ + #endif + #endif + +-#ifdef _WIN32 +- ++#if !defined(__clang__) || __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 7) + // Clang-only nullability specifiers + #define _Nonnull + #define _Nullable ++#endif ++ ++#ifdef _WIN32 + + #include + #include +@@ -401,6 +401,11 @@ typedef std::unique_ptr + ++#if defined(__Bitrig__) || defined(__DragonFly__) || \ ++ defined(__FreeBSD__) || defined(__OpenBSD__) ++#include ++#endif ++ + #define OS_PATH_SEPARATORS "/" + #define OS_PATH_SEPARATOR '/' + #define OS_PATH_SEPARATOR_STR "/" +@@ -627,6 +632,12 @@ static __inline__ bool adb_thread_create + static __inline__ int adb_thread_setname(const std::string& name) { + #ifdef __APPLE__ + return pthread_setname_np(name.c_str()); ++#elif defined(__Bitrig__) || defined(__DragonFly__) || \ ++ defined(__FreeBSD__) || defined(__OpenBSD__) ++ pthread_set_name_np(pthread_self(), name.c_str()); ++ return 0; ++#elif defined(__NetBSD__) ++ return pthread_setname_np(pthread_self(), "%s", (void*)name.c_str()); + #else + const char *s = name.c_str(); + Property changes on: head/devel/android-tools-fastboot-devel/files/patch-adb_sysdeps.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/android-tools-fastboot-devel/files/patch-base_errors__unix.cpp =================================================================== --- head/devel/android-tools-fastboot-devel/files/patch-base_errors__unix.cpp (nonexistent) +++ head/devel/android-tools-fastboot-devel/files/patch-base_errors__unix.cpp (revision 409356) @@ -0,0 +1,11 @@ +--- base/errors_unix.cpp.orig 2016-02-20 02:39:51 UTC ++++ base/errors_unix.cpp +@@ -16,7 +16,7 @@ + + #include "android-base/errors.h" + +-#include ++#include + + namespace android { + namespace base { Property changes on: head/devel/android-tools-fastboot-devel/files/patch-base_errors__unix.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/android-tools-fastboot-devel/files/patch-base_parsenetaddress.cpp =================================================================== --- head/devel/android-tools-fastboot-devel/files/patch-base_parsenetaddress.cpp (nonexistent) +++ head/devel/android-tools-fastboot-devel/files/patch-base_parsenetaddress.cpp (revision 409356) @@ -0,0 +1,10 @@ +--- base/parsenetaddress.cpp.orig 2016-02-20 02:39:51 UTC ++++ base/parsenetaddress.cpp +@@ -16,6 +16,7 @@ + + #include "android-base/parsenetaddress.h" + ++#include // sscanf + #include + + #include "android-base/stringprintf.h" Property changes on: head/devel/android-tools-fastboot-devel/files/patch-base_parsenetaddress.cpp ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/android-tools-fastboot-devel/files/patch-fastboot_socket.h =================================================================== --- head/devel/android-tools-fastboot-devel/files/patch-fastboot_socket.h (nonexistent) +++ head/devel/android-tools-fastboot-devel/files/patch-fastboot_socket.h (revision 409356) @@ -0,0 +1,14 @@ +--- fastboot/socket.h.orig 2016-02-20 02:39:51 UTC ++++ fastboot/socket.h +@@ -41,7 +41,10 @@ + + #include + #include +-#include ++ ++// Copied from ++#define FRIEND_TEST(test_case_name, test_name)\ ++friend class test_case_name##_##test_name##_Test + + // Socket interface to be implemented for each platform. + class Socket { Property changes on: head/devel/android-tools-fastboot-devel/files/patch-fastboot_socket.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property