kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Initialize frontend state from the outset
rodzic
0440123bdc
commit
8ed2cd991b
|
@ -281,6 +281,7 @@ sanei_genesys_init_structs (Genesys_Device * dev)
|
|||
for (const auto& frontend : *s_frontends) {
|
||||
if (dev->model->dac_type == frontend.fe_id) {
|
||||
dev->frontend_initial = frontend;
|
||||
dev->frontend = frontend;
|
||||
fe_ok = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -238,6 +238,11 @@ struct Genesys_Device
|
|||
Genesys_Register_Set calib_reg;
|
||||
Genesys_Settings settings;
|
||||
Genesys_Frontend frontend, frontend_initial;
|
||||
|
||||
// whether the frontend is initialized. This is currently used just to preserve historical
|
||||
// behavior
|
||||
bool frontend_is_init = false;
|
||||
|
||||
Genesys_Gpo gpo;
|
||||
Genesys_Motor motor;
|
||||
uint8_t control[6] = {};
|
||||
|
|
|
@ -751,6 +751,7 @@ static void gl843_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint
|
|||
{
|
||||
DBG(DBG_proc, "%s(): setting DAC %u\n", __func__, dev->model->dac_type);
|
||||
dev->frontend = dev->frontend_initial;
|
||||
dev->frontend_is_init = true;
|
||||
}
|
||||
|
||||
// check analog frontend type
|
||||
|
@ -767,9 +768,8 @@ static void gl843_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint
|
|||
|
||||
for (i = 1; i <= 3; i++)
|
||||
{
|
||||
// FIXME: BUG: we should initialize dev->frontend before first use. Right now it's
|
||||
// initialized during genesys_coarse_calibration()
|
||||
if (dev->frontend.regs.empty()) {
|
||||
// FIXME: the check below is just historical artifact, we can remove it when convenient
|
||||
if (!dev->frontend_is_init) {
|
||||
sanei_genesys_fe_write_data(dev, i, 0x00);
|
||||
} else {
|
||||
sanei_genesys_fe_write_data(dev, i, dev->frontend.regs.get_value(0x00 + i));
|
||||
|
@ -781,8 +781,8 @@ static void gl843_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint
|
|||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
// FIXME: BUG: see above
|
||||
if (dev->frontend.regs.empty()) {
|
||||
// FIXME: the check below is just historical artifact, we can remove it when convenient
|
||||
if (!dev->frontend_is_init) {
|
||||
sanei_genesys_fe_write_data(dev, 0x20 + i, 0x00);
|
||||
} else {
|
||||
sanei_genesys_fe_write_data(dev, 0x20 + i, dev->frontend.get_offset(i));
|
||||
|
@ -793,8 +793,8 @@ static void gl843_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint
|
|||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
// FIXME: BUG: see above
|
||||
if (dev->frontend.regs.empty()) {
|
||||
// FIXME: the check below is just historical artifact, we can remove it when convenient
|
||||
if (!dev->frontend_is_init) {
|
||||
sanei_genesys_fe_write_data(dev, 0x24 + i, 0x00);
|
||||
} else {
|
||||
sanei_genesys_fe_write_data(dev, 0x24 + i, dev->frontend.regs.get_value(0x24 + i));
|
||||
|
@ -804,8 +804,8 @@ static void gl843_set_fe(Genesys_Device* dev, const Genesys_Sensor& sensor, uint
|
|||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
// FIXME: BUG: see above
|
||||
if (dev->frontend.regs.empty()) {
|
||||
// FIXME: the check below is just historical artifact, we can remove it when convenient
|
||||
if (!dev->frontend_is_init) {
|
||||
sanei_genesys_fe_write_data(dev, 0x28 + i, 0x00);
|
||||
} else {
|
||||
sanei_genesys_fe_write_data(dev, 0x28 + i, dev->frontend.get_gain(i));
|
||||
|
|
Ładowanie…
Reference in New Issue