Skip to content

Commit

Permalink
Update the examples to the new function
Browse files Browse the repository at this point in the history
  • Loading branch information
Matevz Morato committed Feb 25, 2025
1 parent 72132e2 commit 33f7a29
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/boot_bootloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(){
suitableDevice.platform = X_LINK_ANY_PLATFORM;
suitableDevice.state = X_LINK_FLASH_BOOTED;

status = XLinkFindAllSuitableDevices(suitableDevice, deviceDescAll.data(), deviceDescAll.size(), &numdev);
status = XLinkFindAllSuitableDevices(suitableDevice, deviceDescAll.data(), deviceDescAll.size(), &numdev, XLINK_DEVICE_DEFAULT_SEARCH_TIMEOUT_MS);
if(status != X_LINK_SUCCESS) throw std::runtime_error("Couldn't retrieve all connected devices");

if(numdev == 0){
Expand Down
2 changes: 1 addition & 1 deletion examples/boot_firmware.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main(int argc, const char** argv){
suitableDevice.platform = X_LINK_ANY_PLATFORM;
suitableDevice.state = X_LINK_UNBOOTED;

status = XLinkFindAllSuitableDevices(suitableDevice, deviceDescAll.data(), deviceDescAll.size(), &numdev);
status = XLinkFindAllSuitableDevices(suitableDevice, deviceDescAll.data(), deviceDescAll.size(), &numdev, XLINK_DEVICE_DEFAULT_SEARCH_TIMEOUT_MS);
if(status != X_LINK_SUCCESS) throw std::runtime_error("Couldn't retrieve all connected devices");

if(numdev == 0){
Expand Down
2 changes: 1 addition & 1 deletion examples/list_devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(){
suitableDevice.protocol = X_LINK_ANY_PROTOCOL;
suitableDevice.platform = X_LINK_ANY_PLATFORM;

status = XLinkFindAllSuitableDevices(suitableDevice, deviceDescAll.data(), deviceDescAll.size(), &numdev);
status = XLinkFindAllSuitableDevices(suitableDevice, deviceDescAll.data(), deviceDescAll.size(), &numdev, XLINK_DEVICE_DEFAULT_SEARCH_TIMEOUT_MS);
if(status != X_LINK_SUCCESS) throw std::runtime_error("Couldn't retrieve all connected devices");

// Print device details
Expand Down
3 changes: 1 addition & 2 deletions src/pc/protocols/tcpip_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ static constexpr const auto DEFAULT_DEVICE_DISCOVERY_POOL_TIMEOUT = std::chrono:

constexpr int MSEC_TO_USEC(int x) { return x * 1000; }
static constexpr auto DEVICE_DISCOVERY_SOCKET_TIMEOUT = std::chrono::milliseconds{20};
static constexpr auto DEVICE_DISCOVERY_RES_TIMEOUT = std::chrono::milliseconds{500};

#ifdef HAS_DEBUG
#define DEBUG(...) do { printf(__VA_ARGS__); } while(0)
Expand Down Expand Up @@ -612,7 +611,7 @@ xLinkPlatformErrorCode_t tcpip_perform_search(void* ctx, deviceDesc_t* devices,
num_devices_match++;
}
}
} while(std::chrono::steady_clock::now() - t1 < DEVICE_DISCOVERY_RES_TIMEOUT);
} while(std::chrono::steady_clock::now() - t1 < std::chrono::milliseconds(XLINK_DEVICE_DEFAULT_SEARCH_TIMEOUT_MS));

// if at least one device matched, return OK otherwise return not found
if(num_devices_match <= 0)
Expand Down
2 changes: 1 addition & 1 deletion tests/multithreading_search_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main() {
suitableDevice.protocol = X_LINK_ANY_PROTOCOL;
suitableDevice.platform = X_LINK_ANY_PLATFORM;

auto status = XLinkFindAllSuitableDevices(suitableDevice, deviceDescAll.data(), deviceDescAll.size(), &numdev);
auto status = XLinkFindAllSuitableDevices(suitableDevice, deviceDescAll.data(), deviceDescAll.size(), &numdev, XLINK_DEVICE_DEFAULT_SEARCH_TIMEOUT_MS);
if(status != X_LINK_SUCCESS) throw std::runtime_error("Couldn't retrieve all connected devices");

// Print device details
Expand Down

0 comments on commit 33f7a29

Please sign in to comment.