diff --git a/device/neovifire2/include/neovifire2eth.h b/device/neovifire2/include/neovifire2eth.h index 7f78a8e..f406ac4 100644 --- a/device/neovifire2/include/neovifire2eth.h +++ b/device/neovifire2/include/neovifire2eth.h @@ -31,6 +31,9 @@ public: 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 + const char* serial = device->getNeoDevice().serial; + if(serial[0] != 'C' || serial[1] != 'Y') + continue; // The device is not a FIRE 2 strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial)); neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; } diff --git a/device/radgalaxy/include/radgalaxy.h b/device/radgalaxy/include/radgalaxy.h index a1498bf..fb4d3e7 100644 --- a/device/radgalaxy/include/radgalaxy.h +++ b/device/radgalaxy/include/radgalaxy.h @@ -15,12 +15,13 @@ public: static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADGalaxy; static constexpr const uint16_t PRODUCT_ID = 0x0003; RADGalaxy(neodevice_t neodevice) : Device(neodevice) { - auto transport = std::make_shared(getWritableNeoDevice()); + auto transport = std::unique_ptr(new PCAP(getWritableNeoDevice())); auto packetizer = std::make_shared(); packetizer->disableChecksum = true; packetizer->align16bit = false; - auto decoder = std::make_shared(); - com = std::make_shared(transport, packetizer, decoder); + auto encoder = std::unique_ptr(new Encoder(packetizer)); + auto decoder = std::unique_ptr(new Decoder()); + com = std::make_shared(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } @@ -29,12 +30,15 @@ public: std::vector> found; for(auto neodevice : PCAP::FindByProduct(PRODUCT_ID)) { - { + { // Scope created so that we don't have two of the same device at once strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial)); neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; - auto device = std::make_shared(neodevice); + 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 + const char* serial = device->getNeoDevice().serial; + if(serial[0] != 'R' || serial[1] != 'G') + continue; // The device is not a RADGalaxy strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial)); neodevice.serial[sizeof(neodevice.serial) - 1] = '\0'; } diff --git a/platform/windows/include/devices.h b/platform/windows/include/devices.h index 5219fcf..7b6deca 100644 --- a/platform/windows/include/devices.h +++ b/platform/windows/include/devices.h @@ -8,7 +8,7 @@ #include "device/neovifire2/include/neovifire2usb.h" // #include "device/plasion/include/neoviion.h" // #include "device/plasion/include/neoviplasma.h" -// #include "device/radgalaxy/include/radgalaxy.h" +#include "device/radgalaxy/include/radgalaxy.h" // #include "device/radstar2/include/radstar2.h" // #include "device/radsupermoon/include/radsupermoon.h" // #include "device/valuecan3/include/valuecan3.h" diff --git a/platform/windows/pcap.cpp b/platform/windows/pcap.cpp index 7f924e6..8a3689b 100644 --- a/platform/windows/pcap.cpp +++ b/platform/windows/pcap.cpp @@ -131,8 +131,10 @@ std::vector PCAP::FindByProduct(int product) { EthernetPacket packet(data, header->caplen); if(packet.etherType == 0xCAB2 && packet.srcMAC[0] == 0x00 && packet.srcMAC[1] == 0xFC && packet.srcMAC[2] == 0x70) { - if(product != packet.srcMAC[3]) // This is where the PID is stored in the MAC - continue; // This is not a product we're currently looking for + /* Here we could check packet.srcMAC[3] against the PID, however for some devices + * this is not correct. For this reason, we don't check the product here and instead + * check the serial number that comes back later. + */ neodevice_t neodevice; /* Unlike other transport layers, we can't get the serial number here as we