Some final tidying.

This commit is contained in:
dg
2023-04-04 20:12:21 +00:00
parent 63544647b6
commit 2022732dd9
7 changed files with 195 additions and 22 deletions

View File

@@ -42,7 +42,10 @@ std::vector<std::shared_ptr<CandidateDevice>> findUsbDevices()
{
libusbp::serial_port port(candidate->device);
candidate->serialPort = port.get_name();
candidate->type = DEVICE_GREASEWEAZLE;
}
else if (id == FLUXENGINE_ID)
candidate->type = DEVICE_FLUXENGINE;
candidates.push_back(std::move(candidate));
}
@@ -50,3 +53,19 @@ std::vector<std::shared_ptr<CandidateDevice>> findUsbDevices()
return candidates;
}
std::string getDeviceName(DeviceType type)
{
switch (type)
{
case DEVICE_GREASEWEAZLE:
return "Greaseweazle";
case DEVICE_FLUXENGINE:
return "FluxEngine";
default:
return "unknown";
}
}

View File

@@ -4,8 +4,17 @@
#include "libusbp_config.h"
#include "libusbp.hpp"
enum DeviceType
{
DEVICE_FLUXENGINE,
DEVICE_GREASEWEAZLE
};
extern std::string getDeviceName(DeviceType type);
struct CandidateDevice
{
DeviceType type;
libusbp::device device;
uint32_t id;
std::string serial;