diff --git a/device/neovifire2/include/neovifire2eth.h b/device/neovifire2/include/neovifire2eth.h index 7f37dfd..1e3a46d 100644 --- a/device/neovifire2/include/neovifire2eth.h +++ b/device/neovifire2/include/neovifire2eth.h @@ -22,12 +22,16 @@ public: std::vector> found; for(auto neodevice : PCAP::FindByProduct(PRODUCT_ID)) { - strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial)); - neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; - auto device = std::make_shared(neodevice); - if(!device->open()) // We will get the serial number on open - continue; // If the open failed, we won't display the device as an option to connect to - found.push_back(device); + { + strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial)); + neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; + auto device = std::make_shared(neodevice); + if(!device->open()) // We will get the serial number on open + continue; // If the open failed, we won't display the device as an option to connect to + strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial)); + neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; + } + found.push_back(std::make_shared(neodevice)); } return found; diff --git a/device/radgalaxy/include/radgalaxy.h b/device/radgalaxy/include/radgalaxy.h index b23713f..e32093c 100644 --- a/device/radgalaxy/include/radgalaxy.h +++ b/device/radgalaxy/include/radgalaxy.h @@ -28,12 +28,16 @@ public: std::vector> found; for(auto neodevice : PCAP::FindByProduct(PRODUCT_ID)) { - strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial)); - neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; - auto device = std::make_shared(neodevice); - if(!device->open()) // We will get the serial number on open - continue; // If the open failed, we won't display the device as an option to connect to - found.push_back(device); + { + strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial)); + neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; + auto device = std::make_shared(neodevice); + if(!device->open()) // We will get the serial number on open + continue; // If the open failed, we won't display the device as an option to connect to + strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial)); + neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; + } + found.push_back(std::make_shared(neodevice)); } return found;