Fix PCAP MAC PID issues by checking against the serial returned instead
parent
efe04128fb
commit
6ad4e564b9
|
|
@ -31,6 +31,9 @@ public:
|
||||||
auto device = std::make_shared<NeoVIFIRE2ETH>(neodevice);
|
auto device = std::make_shared<NeoVIFIRE2ETH>(neodevice);
|
||||||
if(!device->open()) // We will get the serial number on open
|
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
|
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));
|
strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial));
|
||||||
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
|
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,13 @@ public:
|
||||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADGalaxy;
|
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADGalaxy;
|
||||||
static constexpr const uint16_t PRODUCT_ID = 0x0003;
|
static constexpr const uint16_t PRODUCT_ID = 0x0003;
|
||||||
RADGalaxy(neodevice_t neodevice) : Device(neodevice) {
|
RADGalaxy(neodevice_t neodevice) : Device(neodevice) {
|
||||||
auto transport = std::make_shared<PCAP>(getWritableNeoDevice());
|
auto transport = std::unique_ptr<ICommunication>(new PCAP(getWritableNeoDevice()));
|
||||||
auto packetizer = std::make_shared<Packetizer>();
|
auto packetizer = std::make_shared<Packetizer>();
|
||||||
packetizer->disableChecksum = true;
|
packetizer->disableChecksum = true;
|
||||||
packetizer->align16bit = false;
|
packetizer->align16bit = false;
|
||||||
auto decoder = std::make_shared<Decoder>();
|
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
|
||||||
com = std::make_shared<Communication>(transport, packetizer, decoder);
|
auto decoder = std::unique_ptr<Decoder>(new Decoder());
|
||||||
|
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
|
||||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||||
productId = PRODUCT_ID;
|
productId = PRODUCT_ID;
|
||||||
}
|
}
|
||||||
|
|
@ -29,12 +30,15 @@ public:
|
||||||
std::vector<std::shared_ptr<Device>> found;
|
std::vector<std::shared_ptr<Device>> found;
|
||||||
|
|
||||||
for(auto neodevice : PCAP::FindByProduct(PRODUCT_ID)) {
|
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));
|
strncpy(neodevice.serial, SERIAL_FIND_ON_OPEN, sizeof(neodevice.serial));
|
||||||
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
|
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
|
||||||
auto device = std::make_shared<RADGalaxy>(neodevice);
|
auto device = std::make_shared<NeoVIFIRE2ETH>(neodevice);
|
||||||
if(!device->open()) // We will get the serial number on open
|
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
|
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));
|
strncpy(neodevice.serial, device->getNeoDevice().serial, sizeof(neodevice.serial));
|
||||||
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
|
neodevice.serial[sizeof(neodevice.serial) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include "device/neovifire2/include/neovifire2usb.h"
|
#include "device/neovifire2/include/neovifire2usb.h"
|
||||||
// #include "device/plasion/include/neoviion.h"
|
// #include "device/plasion/include/neoviion.h"
|
||||||
// #include "device/plasion/include/neoviplasma.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/radstar2/include/radstar2.h"
|
||||||
// #include "device/radsupermoon/include/radsupermoon.h"
|
// #include "device/radsupermoon/include/radsupermoon.h"
|
||||||
// #include "device/valuecan3/include/valuecan3.h"
|
// #include "device/valuecan3/include/valuecan3.h"
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,10 @@ std::vector<neodevice_t> PCAP::FindByProduct(int product) {
|
||||||
|
|
||||||
EthernetPacket packet(data, header->caplen);
|
EthernetPacket packet(data, header->caplen);
|
||||||
if(packet.etherType == 0xCAB2 && packet.srcMAC[0] == 0x00 && packet.srcMAC[1] == 0xFC && packet.srcMAC[2] == 0x70) {
|
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
|
/* Here we could check packet.srcMAC[3] against the PID, however for some devices
|
||||||
continue; // This is not a product we're currently looking for
|
* 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;
|
neodevice_t neodevice;
|
||||||
/* Unlike other transport layers, we can't get the serial number here as we
|
/* Unlike other transport layers, we can't get the serial number here as we
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue