diff options
-rw-r--r-- | Android.mk | 3 | ||||
-rwxr-xr-x | OSX/install-kext.sh | 13 | ||||
-rw-r--r-- | heimdall/config.h | 79 | ||||
-rw-r--r-- | heimdall/source/Android.mk | 37 | ||||
-rw-r--r-- | heimdall/source/BridgeManager.cpp | 36 |
5 files changed, 155 insertions, 13 deletions
diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..ef9b4df --- /dev/null +++ b/Android.mk @@ -0,0 +1,3 @@ +LOCAL_PATH := $(call my-dir) + +include $(LOCAL_PATH)/heimdall/source/Android.mk diff --git a/OSX/install-kext.sh b/OSX/install-kext.sh index 9df64df..4379aec 100755 --- a/OSX/install-kext.sh +++ b/OSX/install-kext.sh @@ -1,7 +1,6 @@ -#!/bin/bash
-echo 'Installing Driver...'
-sudo cp -R heimdall.kext /System/Library/Extensions
-sudo chmod -R 755 /System/Library/Extensions/heimdall.kext
-sudo chown -R root:wheel /System/Library/Extensions/heimdall.kext
-sudo kextload /System/Library/Extensions/heimdall.kext
-echo 'Installation complete. If Heimdall cannot recognise your device a reboot may be required.'
+echo 'Installing Driver...' +sudo cp -R heimdall.kext /System/Library/Extensions +sudo chmod -R 755 /System/Library/Extensions/heimdall.kext +sudo chown -R root:wheel /System/Library/Extensions/heimdall.kext +sudo kextload /System/Library/Extensions/heimdall.kext +echo 'Installation complete. If Heimdall cannot recognise your device a reboot may be required.' diff --git a/heimdall/config.h b/heimdall/config.h new file mode 100644 index 0000000..2fef4fb --- /dev/null +++ b/heimdall/config.h @@ -0,0 +1,79 @@ +/* config.h.in. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#define HAVE_DLFCN_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H + +/* Define to 1 if you have the <stdint.h> header file. */ +// #undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Darwin backend */ +#if defined(__APPLE__) +#define OS_DARWIN +#elif defined(__linux__) +/* Linux backend */ +#define OS_LINUX +#else +/* Windows backend */ +#define OS_WINDOWS +#endif + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +// #undef STDC_HEADERS + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif diff --git a/heimdall/source/Android.mk b/heimdall/source/Android.mk new file mode 100644 index 0000000..9d015b9 --- /dev/null +++ b/heimdall/source/Android.mk @@ -0,0 +1,37 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + Arguments.cpp \ + ClosePcScreenAction.cpp \ + DownloadPitAction.cpp \ + FlashAction.cpp \ + InfoAction.cpp \ + PrintPitAction.cpp \ + VersionAction.cpp \ + BridgeManager.cpp \ + DetectAction.cpp \ + DumpAction.cpp \ + HelpAction.cpp \ + Interface.cpp \ + Utility.cpp \ + main.cpp \ + ../../libpit/Source/libpit.cpp + +LOCAL_C_INCLUDES := \ + external/heimdall/libpit/Source \ + external/libusbx/libusb + +LOCAL_STATIC_LIBRARIES := libusbx + +ifeq ($(HOST_OS),darwin) +LOCAL_LDFLAGS := -framework CoreFoundation -framework IOKit +endif + +ifeq ($(HOST_OS),linux) +LOCAL_LDFLAGS := -lpthread -lrt +endif + +LOCAL_MODULE := heimdall +include $(BUILD_HOST_EXECUTABLE) diff --git a/heimdall/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp index ed12b87..5150788 100644 --- a/heimdall/source/BridgeManager.cpp +++ b/heimdall/source/BridgeManager.cpp @@ -524,27 +524,51 @@ bool BridgeManager::DetectDevice(void) struct libusb_device **devices; int deviceCount = libusb_get_device_list(libusbContext, &devices); + bool detected = false; for (int deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++) { libusb_device_descriptor descriptor; libusb_get_device_descriptor(devices[deviceIndex], &descriptor); + libusb_device *heimdallDevice = devices[deviceIndex]; + libusb_ref_device(heimdallDevice); + for (int i = 0; i < BridgeManager::kSupportedDeviceCount; i++) { if (descriptor.idVendor == supportedDevices[i].vendorId && descriptor.idProduct == supportedDevices[i].productId) { - libusb_free_device_list(devices, deviceCount); - - Interface::Print("Device detected\n"); - return (true); + detected = true; + if (verbose) + { + unsigned char stringBuffer[128]; + libusb_device_handle *deviceHandle; + int result = libusb_open(heimdallDevice, &deviceHandle); + if (result == LIBUSB_SUCCESS) { + if (libusb_get_string_descriptor_ascii(deviceHandle, descriptor.iSerialNumber, + stringBuffer, 128) >= 0) + { + Interface::Print("%s\n", stringBuffer); + } + else { + Interface::Print("unknown\n", stringBuffer); + } + libusb_close(deviceHandle); + } + } } } + + libusb_unref_device(heimdallDevice); } libusb_free_device_list(devices, deviceCount); - Interface::PrintDeviceDetectionFailed(); - return (false); + if (!detected) + Interface::PrintDeviceDetectionFailed(); + else if (!verbose) + Interface::Print("Device detected\n"); + + return (detected); } int BridgeManager::Initialise(bool resume) |