Loading adb/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ LOCAL_SRC_FILES := \ $(USB_SRCS) \ shlist.c \ utils.c \ usb_vendors.c \ ifneq ($(USE_SYSDEPS_WIN32),) Loading adb/adb.c +6 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #if !ADB_HOST #include <private/android_filesystem_config.h> #else #include "usb_vendors.h" #endif Loading Loading @@ -833,6 +835,7 @@ int adb_main(int is_daemon) #if ADB_HOST HOST = 1; usb_vendors_init(); usb_init(); local_init(); Loading Loading @@ -916,6 +919,9 @@ int adb_main(int is_daemon) fdevent_loop(); usb_cleanup(); #if ADB_HOST usb_vendors_cleanup(); #endif return 0; } Loading adb/adb.h +2 −0 Original line number Diff line number Diff line Loading @@ -375,7 +375,9 @@ int usb_close(usb_handle *h); void usb_kick(usb_handle *h); /* used for USB device detection */ #if ADB_HOST int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol); #endif unsigned host_to_le32(unsigned n); int adb_commandline(int argc, char **argv); Loading adb/transport_usb.c +17 −13 Original line number Diff line number Diff line Loading @@ -23,6 +23,10 @@ #define TRACE_TAG TRACE_TRANSPORT #include "adb.h" #if ADB_HOST #include "usb_vendors.h" #endif /* XXX better define? */ #ifdef __ppc__ #define H4(x) (((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) Loading Loading @@ -125,17 +129,12 @@ void init_usb_transport(atransport *t, usb_handle *h) #endif } #if ADB_HOST int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol) { if (vid == VENDOR_ID_GOOGLE) { /* might support adb */ } else if (vid == VENDOR_ID_HTC) { /* might support adb */ } else { /* not supported */ return 0; } unsigned i; for (i = 0; i < vendorIdCount; i++) { if (vid == vendorIds[i]) { /* class:vendor (0xff) subclass:android (0x42) proto:adb (0x01) */ if(usb_class == 0xff) { if((usb_subclass == 0x42) && (usb_protocol == 0x01)) { Loading @@ -145,3 +144,8 @@ int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_ return 0; } } return 0; } #endif adb/usb_osx.c +12 −9 Original line number Diff line number Diff line Loading @@ -28,20 +28,15 @@ #define TRACE_TAG TRACE_USB #include "adb.h" #include "usb_vendors.h" #define DBG D #define ADB_SUBCLASS 0x42 #define ADB_PROTOCOL 0x1 int vendorIds[] = { VENDOR_ID_GOOGLE, VENDOR_ID_HTC, }; #define NUM_VENDORS (sizeof(vendorIds)/sizeof(vendorIds[0])) static IONotificationPortRef notificationPort = 0; static io_iterator_t notificationIterators[NUM_VENDORS]; static io_iterator_t* notificationIterators; struct usb_handle { Loading Loading @@ -81,7 +76,7 @@ InitUSB() memset(notificationIterators, 0, sizeof(notificationIterators)); //* loop through all supported vendors for (i = 0; i < NUM_VENDORS; i++) { for (i = 0; i < vendorIdCount; i++) { //* Create our matching dictionary to find the Android device's //* adb interface //* IOServiceAddMatchingNotification consumes the reference, so we do Loading Loading @@ -374,7 +369,7 @@ void* RunLoopThread(void* unused) CFRunLoopRun(); currentRunLoop = 0; for (i = 0; i < NUM_VENDORS; i++) { for (i = 0; i < vendorIdCount; i++) { IOObjectRelease(notificationIterators[i]); } IONotificationPortDestroy(notificationPort); Loading @@ -391,6 +386,9 @@ void usb_init() { adb_thread_t tid; notificationIterators = (io_iterator_t*)malloc( vendorIdCount * sizeof(io_iterator_t)); adb_mutex_init(&start_lock, NULL); adb_cond_init(&start_cond, NULL); Loading @@ -415,6 +413,11 @@ void usb_cleanup() close_usb_devices(); if (currentRunLoop) CFRunLoopStop(currentRunLoop); if (notificationIterators != NULL) { free(notificationIterators); notificationIterators = NULL; } } int usb_write(usb_handle *handle, const void *buf, int len) Loading Loading
adb/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ LOCAL_SRC_FILES := \ $(USB_SRCS) \ shlist.c \ utils.c \ usb_vendors.c \ ifneq ($(USE_SYSDEPS_WIN32),) Loading
adb/adb.c +6 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #if !ADB_HOST #include <private/android_filesystem_config.h> #else #include "usb_vendors.h" #endif Loading Loading @@ -833,6 +835,7 @@ int adb_main(int is_daemon) #if ADB_HOST HOST = 1; usb_vendors_init(); usb_init(); local_init(); Loading Loading @@ -916,6 +919,9 @@ int adb_main(int is_daemon) fdevent_loop(); usb_cleanup(); #if ADB_HOST usb_vendors_cleanup(); #endif return 0; } Loading
adb/adb.h +2 −0 Original line number Diff line number Diff line Loading @@ -375,7 +375,9 @@ int usb_close(usb_handle *h); void usb_kick(usb_handle *h); /* used for USB device detection */ #if ADB_HOST int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol); #endif unsigned host_to_le32(unsigned n); int adb_commandline(int argc, char **argv); Loading
adb/transport_usb.c +17 −13 Original line number Diff line number Diff line Loading @@ -23,6 +23,10 @@ #define TRACE_TAG TRACE_TRANSPORT #include "adb.h" #if ADB_HOST #include "usb_vendors.h" #endif /* XXX better define? */ #ifdef __ppc__ #define H4(x) (((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) Loading Loading @@ -125,17 +129,12 @@ void init_usb_transport(atransport *t, usb_handle *h) #endif } #if ADB_HOST int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol) { if (vid == VENDOR_ID_GOOGLE) { /* might support adb */ } else if (vid == VENDOR_ID_HTC) { /* might support adb */ } else { /* not supported */ return 0; } unsigned i; for (i = 0; i < vendorIdCount; i++) { if (vid == vendorIds[i]) { /* class:vendor (0xff) subclass:android (0x42) proto:adb (0x01) */ if(usb_class == 0xff) { if((usb_subclass == 0x42) && (usb_protocol == 0x01)) { Loading @@ -145,3 +144,8 @@ int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_ return 0; } } return 0; } #endif
adb/usb_osx.c +12 −9 Original line number Diff line number Diff line Loading @@ -28,20 +28,15 @@ #define TRACE_TAG TRACE_USB #include "adb.h" #include "usb_vendors.h" #define DBG D #define ADB_SUBCLASS 0x42 #define ADB_PROTOCOL 0x1 int vendorIds[] = { VENDOR_ID_GOOGLE, VENDOR_ID_HTC, }; #define NUM_VENDORS (sizeof(vendorIds)/sizeof(vendorIds[0])) static IONotificationPortRef notificationPort = 0; static io_iterator_t notificationIterators[NUM_VENDORS]; static io_iterator_t* notificationIterators; struct usb_handle { Loading Loading @@ -81,7 +76,7 @@ InitUSB() memset(notificationIterators, 0, sizeof(notificationIterators)); //* loop through all supported vendors for (i = 0; i < NUM_VENDORS; i++) { for (i = 0; i < vendorIdCount; i++) { //* Create our matching dictionary to find the Android device's //* adb interface //* IOServiceAddMatchingNotification consumes the reference, so we do Loading Loading @@ -374,7 +369,7 @@ void* RunLoopThread(void* unused) CFRunLoopRun(); currentRunLoop = 0; for (i = 0; i < NUM_VENDORS; i++) { for (i = 0; i < vendorIdCount; i++) { IOObjectRelease(notificationIterators[i]); } IONotificationPortDestroy(notificationPort); Loading @@ -391,6 +386,9 @@ void usb_init() { adb_thread_t tid; notificationIterators = (io_iterator_t*)malloc( vendorIdCount * sizeof(io_iterator_t)); adb_mutex_init(&start_lock, NULL); adb_cond_init(&start_cond, NULL); Loading @@ -415,6 +413,11 @@ void usb_cleanup() close_usb_devices(); if (currentRunLoop) CFRunLoopStop(currentRunLoop); if (notificationIterators != NULL) { free(notificationIterators); notificationIterators = NULL; } } int usb_write(usb_handle *handle, const void *buf, int len) Loading