diff options
author | Koushik Dutta <koushd@gmail.com> | 2013-04-24 14:42:48 -0700 |
---|---|---|
committer | Koushik Dutta <koushd@gmail.com> | 2013-04-24 14:42:48 -0700 |
commit | 117b4fa5d9781e7cfd60dd20c5c4ec76d32172a5 (patch) | |
tree | 284a447e2720b7d1c11b9577306a01c955fbb425 | |
parent | 7f3c870e04a8fa35ea3e59dd15460f290502d178 (diff) | |
download | external_heimdall-117b4fa5d9781e7cfd60dd20c5c4ec76d32172a5.zip external_heimdall-117b4fa5d9781e7cfd60dd20c5c4ec76d32172a5.tar.gz external_heimdall-117b4fa5d9781e7cfd60dd20c5c4ec76d32172a5.tar.bz2 |
Heimdall: change line endings on osx install script.
Heimdall detect: add more detail on verbose option.
Change-Id: I3858289a6270c8a7105b9e32dd4f124bbc7c1acd
-rwxr-xr-x | OSX/install-kext.sh | 13 | ||||
-rw-r--r-- | heimdall/source/BridgeManager.cpp | 36 |
2 files changed, 36 insertions, 13 deletions
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/source/BridgeManager.cpp b/heimdall/source/BridgeManager.cpp index aa7b969..805029a 100644 --- a/heimdall/source/BridgeManager.cpp +++ b/heimdall/source/BridgeManager.cpp @@ -519,27 +519,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() |