genesys: Correctly serialize GenesysFrontendLayout

merge-requests/238/head
Povilas Kanapickas 2019-11-10 10:32:07 +02:00
rodzic 8557e0c220
commit 84e4ababa5
2 zmienionych plików z 27 dodań i 3 usunięć

Wyświetl plik

@ -4476,7 +4476,7 @@ static void probe_genesys_devices (void)
of Genesys_Calibration_Cache as is.
*/
static const char* CALIBRATION_IDENT = "sane_genesys";
static const int CALIBRATION_VERSION = 16;
static const int CALIBRATION_VERSION = 17;
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
const std::string& path)

Wyświetl plik

@ -74,6 +74,20 @@ enum class FrontendType : unsigned
ANALOG_DEVICES
};
inline void serialize(std::istream& str, FrontendType& x)
{
unsigned value;
serialize(str, value);
x = static_cast<FrontendType>(value);
}
inline void serialize(std::ostream& str, FrontendType& x)
{
unsigned value = static_cast<unsigned>(x);
serialize(str, value);
}
struct GenesysFrontendLayout
{
FrontendType type = FrontendType::UNKNOWN;
@ -88,6 +102,17 @@ struct GenesysFrontendLayout
}
};
template<class Stream>
void serialize(Stream& str, GenesysFrontendLayout& x)
{
serialize(str, x.type);
serialize_newline(str);
serialize(str, x.offset_addr);
serialize_newline(str);
serialize(str, x.gain_addr);
}
/** @brief Data structure to set up analog frontend.
The analog frontend converts analog value from image sensor to digital value. It has its own
control registers which are set up with this structure. The values are written using
@ -146,8 +171,7 @@ void serialize(Stream& str, Genesys_Frontend& x)
serialize_newline(str);
serialize(str, x.reg2);
serialize_newline(str);
serialize(str, x.layout.offset_addr);
serialize(str, x.layout.gain_addr);
serialize(str, x.layout);
}
struct SensorExposure {