+++ /dev/null
-Description: <short summary of the patch>
- TODO: Put a short summary on the line above and replace this paragraph
- with a longer explanation of this change. Complete the meta-information
- with other relevant fields (see below for details). To make it easier, the
- information below has been extracted from the changelog. Adjust it or drop
- it.
- .
- heimdall-flash (1.4.1-2) unstable; urgency=medium
- .
- * Add options for simultaneous flashing on multiple devices
-Author: Donghoon Shin <dhs.shin@samsung.com>
-
----
-The information above should follow the Patch Tagging Guidelines, please
-checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
-are templates for supplementary fields that you might want to add:
-
-Origin: <vendor|upstream|other>, <url of original patch>
-Bug: <url in upstream bugtracker>
-Bug-Debian: http://bugs.debian.org/<bugnumber>
-Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
-Forwarded: <no|not-needed|url proving that it has been forwarded>
-Reviewed-By: <name and email of someone who approved the patch>
-Last-Update: <YYYY-MM-DD>
-
---- heimdall-flash-1.4.1.orig/heimdall/source/BridgeManager.cpp
-+++ heimdall-flash-1.4.1/heimdall/source/BridgeManager.cpp
-@@ -88,6 +88,16 @@ enum
- kPitSizeMultiplicand = 4096
- };
-
-+void BridgeManager::SetUsbBus(int usbbus)
-+{
-+ this->usbbus = usbbus;
-+}
-+
-+void BridgeManager::SetUsbDevAddr(int usbdevaddr)
-+{
-+ this->usbdevaddr = usbdevaddr;
-+}
-+
- int BridgeManager::FindDeviceInterface(void)
- {
- Interface::Print("Detecting device...\n");
-@@ -98,15 +108,21 @@ int BridgeManager::FindDeviceInterface(v
- for (int deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++)
- {
- libusb_device_descriptor descriptor;
-+ uint8_t bus_num, device_address;
- libusb_get_device_descriptor(devices[deviceIndex], &descriptor);
-+ bus_num = libusb_get_bus_number(devices[deviceIndex]);
-+ device_address = libusb_get_device_address(devices[deviceIndex]);
-
- for (int i = 0; i < BridgeManager::kSupportedDeviceCount; i++)
- {
- if (descriptor.idVendor == supportedDevices[i].vendorId && descriptor.idProduct == supportedDevices[i].productId)
- {
-- heimdallDevice = devices[deviceIndex];
-- libusb_ref_device(heimdallDevice);
-- break;
-+ if (this->usbbus == -1 || this->usbdevaddr == -1 || (this->usbbus == bus_num && this->usbdevaddr == device_address))
-+ {
-+ heimdallDevice = devices[deviceIndex];
-+ libusb_ref_device(heimdallDevice);
-+ break;
-+ }
- }
- }
-
-@@ -357,6 +373,8 @@ bool BridgeManager::InitialiseProtocol(v
- BridgeManager::BridgeManager(bool verbose)
- {
- this->verbose = verbose;
-+ this->usbbus = -1;
-+ this->usbdevaddr = -1;
-
- libusbContext = nullptr;
- deviceHandle = nullptr;
---- heimdall-flash-1.4.1.orig/heimdall/source/BridgeManager.h
-+++ heimdall-flash-1.4.1/heimdall/source/BridgeManager.h
-@@ -109,6 +109,8 @@ namespace Heimdall
- static const DeviceIdentifier supportedDevices[kSupportedDeviceCount];\r
- \r
- bool verbose;\r
-+ int usbbus;\r
-+ int usbdevaddr;\r
- \r
- libusb_context *libusbContext;\r
- libusb_device_handle *deviceHandle;\r
-@@ -175,6 +177,8 @@ namespace Heimdall
- {\r
- return (verbose);\r
- }\r
-+ void SetUsbBus(int);\r
-+ void SetUsbDevAddr(int);\r
- };\r
- }\r
- \r
---- heimdall-flash-1.4.1.orig/heimdall/source/FlashAction.cpp
-+++ heimdall-flash-1.4.1/heimdall/source/FlashAction.cpp
-@@ -43,10 +43,12 @@ Arguments:\n\
- [--<partition identifier> <filename> ...]\n\
- [--pit <filename>] [--verbose] [--no-reboot] [--resume] [--stdout-errors]\n\
- [--usb-log-level <none/error/warning/debug>]\n\
-+ [--usbbus <usbbus>] [--usbdevaddr <usb-dev-address>]\n\
- or:\n\
- --repartition --pit <filename> [--<partition name> <filename> ...]\n\
- [--<partition identifier> <filename> ...] [--verbose] [--no-reboot]\n\
- [--resume] [--stdout-errors] [--usb-log-level <none/error/warning/debug>]\n\
-+ [--usbbus <usbbus>] [--usbdevaddr <usb-dev-address>]\n\
- Description: Flashes one or more firmware files to your phone. Partition names\n\
- (or identifiers) can be obtained by executing the print-pit action.\n\
- Note: --no-reboot causes the device to remain in download mode after the action\n\
-@@ -393,6 +395,8 @@ int FlashAction::Execute(int argc, char
- argumentTypes["verbose"] = kArgumentTypeFlag;
- argumentTypes["stdout-errors"] = kArgumentTypeFlag;
- argumentTypes["usb-log-level"] = kArgumentTypeString;
-+ argumentTypes["usbbus"] = kArgumentTypeString;
-+ argumentTypes["usbdevaddr"] = kArgumentTypeString;
-
- argumentTypes["pit"] = kArgumentTypeString;
- shortArgumentAliases["pit"] = "pit";
-@@ -498,6 +502,21 @@ int FlashAction::Execute(int argc, char
- BridgeManager *bridgeManager = new BridgeManager(verbose);
- bridgeManager->SetUsbLogLevel(usbLogLevel);
-
-+ const StringArgument *usbBus = static_cast<const StringArgument *>(arguments.GetArgument("usbbus"));
-+ const StringArgument *usbDevAddr = static_cast<const StringArgument *>(arguments.GetArgument("usbdevaddr"));
-+
-+ if (usbBus)
-+ {
-+ const string& usbBusString = usbBus->GetValue();
-+ bridgeManager->SetUsbBus(stoi(usbBusString));
-+ }
-+
-+ if (usbDevAddr)
-+ {
-+ const string& usbDevAddrString = usbDevAddr->GetValue();
-+ bridgeManager->SetUsbDevAddr(stoi(usbDevAddrString));
-+ }
-+
- if (bridgeManager->Initialise(resume) != BridgeManager::kInitialiseSucceeded || !bridgeManager->BeginSession())
- {
- closeFiles(partitionFiles, pitFile);