1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00

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

files/usb_libusb.cpp chases the following commits:
https://android.googlesource.com/platform/system/core/+/49ee7cf%5E!/#F6
https://android.googlesource.com/platform/system/core/+/7a3f8d6%5E!/

Changes:	94a845d..e4c1bb5/adb
Changes:	94a845d..e4c1bb5/fastboot
This commit is contained in:
Jan Beich 2015-09-05 22:49:27 +00:00
parent aa2c09f705
commit f3f1547a3d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=396202
7 changed files with 87 additions and 58 deletions

View File

@ -1,7 +1,7 @@
# $FreeBSD$
DISTVERSION= m-preview-890
DISTVERSIONSUFFIX= -g94a845d
DISTVERSION= m-preview-1112
DISTVERSIONSUFFIX= -ge4c1bb5
PORTREVISION= 0
PKGNAMESUFFIX= -devel

View File

@ -1,4 +1,4 @@
SHA256 (android-platform_system_core-android-m-preview-890-g94a845d_GH0.tar.gz) = c10c0b901070721a74a5c84b4de83e92bd61cbb7093e4b14ba54fafb817f4ed9
SIZE (android-platform_system_core-android-m-preview-890-g94a845d_GH0.tar.gz) = 1336992
SHA256 (android-platform_system_core-android-m-preview-1112-ge4c1bb5_GH0.tar.gz) = 3fafd204d1ccf075fc5772937ef6e82f14d359f6ae4a9dbf9541e70314283fee
SIZE (android-platform_system_core-android-m-preview-1112-ge4c1bb5_GH0.tar.gz) = 1342470
SHA256 (bash_completion.d/adb?id=2b8cfec) = 0d7989596a3e4937834d582eb0ddc88b8186505570772304fe51870d473916a7
SIZE (bash_completion.d/adb?id=2b8cfec) = 5198

View File

@ -16,6 +16,7 @@ SRCS+= console.cpp
SRCS+= fdevent.cpp
SRCS+= file_sync_client.cpp
SRCS+= services.cpp
SRCS+= shell_service_protocol.cpp
SRCS+= sockets.cpp
SRCS+= transport.cpp
SRCS+= transport_local.cpp

View File

@ -0,0 +1,27 @@
--- adb/sysdeps.h.orig 2015-09-05 00:01:27 UTC
+++ adb/sysdeps.h
@@ -401,6 +401,11 @@ typedef std::unique_ptr<HANDLE, handle_d
#include <string>
+#if defined(__Bitrig__) || defined(__DragonFly__) || \
+ defined(__FreeBSD__) || defined(__OpenBSD__)
+#include <pthread_np.h>
+#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();

View File

@ -69,23 +69,23 @@ report_bulk_libusb_error(int r)
{
switch (r) {
case LIBUSB_ERROR_TIMEOUT:
D("Transfer timeout\n");
D("Transfer timeout");
break;
case LIBUSB_ERROR_PIPE:
D("Control request is not supported\n");
D("Control request is not supported");
break;
case LIBUSB_ERROR_OVERFLOW:
D("Device offered more data\n");
D("Device offered more data");
break;
case LIBUSB_ERROR_NO_DEVICE :
D("Device was disconnected\n");
D("Device was disconnected");
break;
default:
D("Error %d during transfer\n", r);
D("Error %d during transfer", r);
break;
};
}
@ -140,7 +140,7 @@ usb_write(usb_handle *uh, const void *_data, int len)
}
}
D("usb_write(): %p:%d -> transport %p\n", _data, len, uh);
D("usb_write(): %p:%d -> transport %p", _data, len, uh);
while (len > 0) {
int xfer = (len > 4096) ? 4096 : len;
@ -148,7 +148,7 @@ usb_write(usb_handle *uh, const void *_data, int len)
n = usb_bulk_write(uh, data, xfer);
if (n != xfer) {
D("usb_write(): failed for transport %p (%d bytes left)\n", uh, len);
D("usb_write(): failed for transport %p (%d bytes left)", uh, len);
return -1;
}
@ -160,7 +160,7 @@ usb_write(usb_handle *uh, const void *_data, int len)
n = usb_bulk_write(uh, _data, 0);
if (n < 0) {
D("usb_write(): failed to finish operation for transport %p\n", uh);
D("usb_write(): failed to finish operation for transport %p", uh);
}
return n;
}
@ -174,7 +174,7 @@ usb_read(usb_handle *uh, void *_data, int len)
unsigned char *data = (unsigned char*)_data;
int n;
D("usb_read(): %p:%d <- transport %p\n", _data, len, uh);
D("usb_read(): %p:%d <- transport %p", _data, len, uh);
while (len > 0) {
int xfer = (len > 4096) ? 4096 : len;
@ -188,7 +188,7 @@ usb_read(usb_handle *uh, void *_data, int len)
continue;
}
D("usb_read(): failed for transport %p (%d bytes left)\n", uh, len);
D("usb_read(): failed for transport %p (%d bytes left)", uh, len);
return -1;
}
@ -202,7 +202,7 @@ usb_read(usb_handle *uh, void *_data, int len)
int
usb_close(usb_handle *h)
{
D("usb_close(): closing transport %p\n", h);
D("usb_close(): closing transport %p", h);
adb_mutex_lock(&usb_lock);
h->next->prev = h->prev;
@ -224,7 +224,7 @@ usb_close(usb_handle *h)
void
usb_kick(usb_handle *h)
{
D("usb_kick(): kicking transport %p\n", h);
D("usb_kick(): kicking transport %p", h);
adb_mutex_lock(&h->lock);
unregister_usb_transport(h);
@ -249,14 +249,14 @@ check_usb_interface(libusb_interface const *interface,
int e;
if (interface->num_altsetting == 0) {
D("check_usb_interface(): No interface settings\n");
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\n");
D("check_usb_interface(): Interface have not 2 endpoints, ignoring");
return -1;
}
@ -264,7 +264,7 @@ check_usb_interface(libusb_interface const *interface,
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\n",
D("check_usb_interface(): Endpoint (%u) is not bulk (%u), ignoring",
edesc->bmAttributes, LIBUSB_TRANSFER_TYPE_BULK);
return -1;
}
@ -277,7 +277,7 @@ check_usb_interface(libusb_interface const *interface,
/* 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\n");
D("check_usb_interface(): Forced Android interface protocol v.1");
}
}
@ -291,11 +291,11 @@ check_usb_interface(libusb_interface const *interface,
idesc->bInterfaceClass, idesc->bInterfaceSubClass,
idesc->bInterfaceProtocol))
{
D("not matches\n");
D("not matches");
return -1;
}
D("matches\n");
D("matches");
return 1;
}
@ -310,7 +310,7 @@ check_usb_interfaces(libusb_config_descriptor *config,
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\n", i, desc->idVendor,
"matches Android device", i, desc->idVendor,
desc->idProduct);
return i;
@ -323,7 +323,7 @@ check_usb_interfaces(libusb_config_descriptor *config,
static int
register_device(usb_handle *uh, const char *serial)
{
D("register_device(): Registering %p [%s] as USB transport\n",
D("register_device(): Registering %p [%s] as USB transport",
uh, serial);
usb_handle* usb = reinterpret_cast<usb_handle*>(calloc(1, sizeof(usb_handle)));
@ -388,20 +388,20 @@ check_device(libusb_device *dev)
int r = libusb_get_device_descriptor(dev, &desc);
if (r != LIBUSB_SUCCESS) {
D("check_device(): Failed to get device descriptor\n");
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\n",
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\n");
D("check_device(): Ignored due unknown vendor id");
return;
}
@ -410,30 +410,30 @@ check_device(libusb_device *dev)
if (already_registered(&uh)) {
D("check_device(): Device (bus: %d, address: %d) "
"is already registered\n", uh.dev_bus, uh.dev_addr);
"is already registered", uh.dev_bus, uh.dev_addr);
return;
}
D("check_device(): Device bus: %d, address: %d\n",
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\n",
D("check_device(): Device %4x:%4x is unconfigured",
desc.idVendor, desc.idProduct);
return;
}
D("check_device(): Failed to get configuration for %4x:%4x\n",
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\n");
"getting active config");
return;
}
@ -450,27 +450,27 @@ check_device(libusb_device *dev)
if (r != 0) {
switch (r) {
case LIBUSB_ERROR_NO_MEM:
D("check_device(): Memory allocation problem\n");
D("check_device(): Memory allocation problem");
break;
case LIBUSB_ERROR_ACCESS:
D("check_device(): Permissions problem, "
"current user priveleges are messed up?\n");
"current user priveleges are messed up?");
break;
case LIBUSB_ERROR_NO_DEVICE:
D("check_device(): Device disconected, bad cable?\n");
D("check_device(): Device disconected, bad cable?");
break;
default:
D("check_device(): libusb triggered error %d\n", r);
D("check_device(): libusb triggered error %d", r);
}
// skip rest
found = -1;
}
if (found >= 0) {
D("check_device(): Device matches Android interface\n");
D("check_device(): Device matches Android interface");
// read the device's serial number
memset(serial, 0, sizeof(serial));
uh.interface = found;
@ -478,7 +478,7 @@ check_device(libusb_device *dev)
r = libusb_claim_interface(uh.devh, uh.interface);
if (r < 0) {
D("check_device(): Failed to claim interface %d\n",
D("check_device(): Failed to claim interface %d",
uh.interface);
goto fail;
@ -497,7 +497,7 @@ check_device(libusb_device *dev)
0, (uint8_t *)languages, sizeof(languages), 0);
if (r <= 0) {
D("check_device(): Failed to get languages count\n");
D("check_device(): Failed to get languages count");
goto fail;
}
@ -524,7 +524,7 @@ check_device(libusb_device *dev)
}
if (register_device(&uh, serial) == 0) {
D("check_device(): Failed to register device\n");
D("check_device(): Failed to register device");
goto fail_interface;
}
@ -565,7 +565,7 @@ kick_disconnected()
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\n",
D("kick_disconnected(): Transport %p is not online anymore",
usb);
usb_kick(usb);
@ -578,14 +578,14 @@ kick_disconnected()
static void
scan_usb_devices()
{
D("scan_usb_devices(): started\n");
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)\n",
D("scan_usb_devices(): Failed to get device list (error: %zd)",
cnt);
return;
@ -603,7 +603,8 @@ scan_usb_devices()
static void *
device_poll_thread(void* unused)
{
D("device_poll_thread(): Created USB scan thread\n");
adb_thread_setname("USB scan");
D("device_poll_thread(): Created USB scan thread");
for (;;) {
sleep(5);
@ -624,14 +625,14 @@ sigalrm_handler(int signo)
void
usb_init()
{
D("usb_init(): started\n");
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\n");
fatal_errno("Failed to init libusb");
}
memset(&actions, 0, sizeof(actions));
@ -648,8 +649,8 @@ usb_init()
/* starting USB event polling thread */
if (!adb_thread_create(device_poll_thread, nullptr)) {
fatal_errno("cannot create USB scan thread\n");
fatal_errno("cannot create USB scan thread");
}
D("usb_init(): finished\n");
D("usb_init(): finished");
}

View File

@ -1,12 +1,12 @@
# $FreeBSD$
DISTVERSION= m-preview-890
DISTVERSIONSUFFIX= -g94a845d
DISTVERSION= m-preview-1112
DISTVERSIONSUFFIX= -ge4c1bb5
PORTREVISION= 0
PKGNAMESUFFIX= -devel
GH_TAGNAME= ${DISTVERSIONFULL:C/-[0-9].*//}-136-g89a2254:extras \
${DISTVERSIONFULL:C/-[0-9].*//}-17-g95736e8:libselinux
GH_TAGNAME= ${DISTVERSIONFULL:C/-[0-9].*//}-170-ga0370d7:extras \
${DISTVERSIONFULL:C/-[0-9].*//}-18-g91b7d91:libselinux
CONFLICTS_INSTALL= ${PORTNAME}-[0-9]*

View File

@ -2,9 +2,9 @@ SHA256 (bash_completion.d/fastboot?id=2b8cfec) = 12ef37bff8230e5e164e4ef5b9c1be1
SIZE (bash_completion.d/fastboot?id=2b8cfec) = 3051
SHA256 (fastboot.1?id=706e754) = 2af01b064440952a82f1602691a0fecc030302722a71444946fb70d9c423d283
SIZE (fastboot.1?id=706e754) = 5906
SHA256 (android-platform_system_core-android-m-preview-890-g94a845d_GH0.tar.gz) = c10c0b901070721a74a5c84b4de83e92bd61cbb7093e4b14ba54fafb817f4ed9
SIZE (android-platform_system_core-android-m-preview-890-g94a845d_GH0.tar.gz) = 1336992
SHA256 (jbeich-platform_system_extras-android-m-preview-136-g89a2254_GH0.tar.gz) = 33813515ba14743085b8e95a4a74025ac4cefd7d308d5870cc8e279ef5380d4a
SIZE (jbeich-platform_system_extras-android-m-preview-136-g89a2254_GH0.tar.gz) = 665360
SHA256 (jbeich-platform_external_libselinux-android-m-preview-17-g95736e8_GH0.tar.gz) = dc1d01e7ce3199e6d68328d976d75ec04f59492bba764888d282f1d2909f57e1
SIZE (jbeich-platform_external_libselinux-android-m-preview-17-g95736e8_GH0.tar.gz) = 58318
SHA256 (android-platform_system_core-android-m-preview-1112-ge4c1bb5_GH0.tar.gz) = 3fafd204d1ccf075fc5772937ef6e82f14d359f6ae4a9dbf9541e70314283fee
SIZE (android-platform_system_core-android-m-preview-1112-ge4c1bb5_GH0.tar.gz) = 1342470
SHA256 (jbeich-platform_system_extras-android-m-preview-170-ga0370d7_GH0.tar.gz) = 8207f52b16340dc14b5caa967683131af1edb7d602454bf7dc51cefd270d7da1
SIZE (jbeich-platform_system_extras-android-m-preview-170-ga0370d7_GH0.tar.gz) = 675090
SHA256 (jbeich-platform_external_libselinux-android-m-preview-18-g91b7d91_GH0.tar.gz) = 92e7867376f77d6d2699764685b36475e14a2de58ccd25fa0c5dc31d6525846d
SIZE (jbeich-platform_external_libselinux-android-m-preview-18-g91b7d91_GH0.tar.gz) = 58379