[sane-devel] genesys backend status update

Gerhard Jaeger gerhard@gjaeger.de
Wed, 11 May 2005 09:55:22 +0200


On Wednesday 11 May 2005 08:12, stef wrote:
> 	Hello,
> 
> 	I've started to address the points you raised (and I sohouldn't have
> forgotten ...). I'll signal when I'll feel the backend is up to the requirements.
> 
> Regards,
> 	Stef
> 
Another thing, I've forgotten:
See the file genesys.c, i.e. function genesys_init()
static SANE_Status
genesys_init (Genesys_Device * dev)
{
  switch (dev->model->asic_type)
    {
    case GENESYS_GL646:
      return sanei_gl646_init (dev);
    case GENESYS_GL841:
      return sanei_gl841_init (dev);
    }
  return SANE_STATUS_INVAL;
}

which is called later on:
RIE (genesys_init (dev));

In a former post, I suggested to use a per ASIC/Model function pointer thing to
use, which could make life much more easier, that way, that you simply write:

dev->model->cmd_set->init(dev);

This will be done as follows:

We define a command set structure with all the functions needed (here
all functions that differ between GL646 and GL841):

struct genesys_cmd_set
{
    SANE_Status (*init) (Genesys_Device * dev);
     .
     .
     .
     .
}

This command set structure then will be part of the Genesys_Model structure,
which is also part of the device structure...
This method is used intensively in gt68xx backend and I think we should
keep this also for the genesys backend as it allows easy extension of
the command set (think of adding also GL842)...

Gerhard