diff --git a/ChangeLog b/ChangeLog index 73540755e..b0e1327b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-03-09 Stéphane Voltz + * backend/genesys.c backend/genesys.h backend/genesys_devices.c + backend/genesys_gl646.c doc/descriptions/lexmark.desc: cleanups + for genesys backend. Change in document detection for gl646 + sheetfed scanners. + - lexmark backend description update + 2009-03-09 Stéphane Voltz * backend/genesys.c backend/genesys_devices.c backend/genesys_gl646.c: 1200 dpi scan fix and head positionning fixes diff --git a/backend/genesys.c b/backend/genesys.c index 240b830b8..0c3df3904 100644 --- a/backend/genesys.c +++ b/backend/genesys.c @@ -1436,9 +1436,6 @@ sanei_genesys_read_data_from_scanner (Genesys_Device * dev, uint8_t * data, DBG (DBG_proc, "sanei_genesys_read_data_from_scanner (size = %lu bytes)\n", (u_long) size); -/*for valgrind*/ -/* memset(data,0,size);*/ - if (size & 1) DBG (DBG_info, "WARNING sanei_genesys_read_data_from_scanner: odd number of bytes\n"); @@ -2497,7 +2494,7 @@ genesys_white_shading_calibration (Genesys_Device * dev) /* turn on motor and lamp power */ dev->model->cmd_set->set_lamp_power (dev, dev->calib_reg, SANE_TRUE); - dev->model->cmd_set->set_motor_power (dev->calib_reg, SANE_TRUE); + dev->model->cmd_set->set_motor_power (dev->calib_reg, SANE_FALSE); /* XXX STEF */ status = dev->model->cmd_set->bulk_write_register (dev, dev->calib_reg, @@ -2639,7 +2636,7 @@ genesys_dark_white_shading_calibration (Genesys_Device * dev) /* turn on motor and lamp power */ dev->model->cmd_set->set_lamp_power (dev, dev->calib_reg, SANE_TRUE); - dev->model->cmd_set->set_motor_power (dev->calib_reg, SANE_TRUE); + dev->model->cmd_set->set_motor_power (dev->calib_reg, SANE_FALSE); status = dev->model->cmd_set->bulk_write_register (dev, dev->calib_reg, @@ -4184,14 +4181,6 @@ genesys_read_ordered_data (Genesys_Device * dev, SANE_Byte * destination, ((dev->model->ld_shift_b * dev->settings.yres) / dev->motor.base_ydpi); - /* TODO find an explanation for this special case */ - /*if(dev->model->motor_type == MOTOR_HP2300 && dev->settings.yres>dev->motor.base_ydpi) - { - ccd_shift[0] *= 2; - ccd_shift[1] *= 2; - ccd_shift[2] *= 2; - }*/ - ccd_shift[3] = ccd_shift[0] + dev->current_setup.stagger; ccd_shift[4] = ccd_shift[1] + dev->current_setup.stagger; ccd_shift[5] = ccd_shift[2] + dev->current_setup.stagger; @@ -4804,8 +4793,6 @@ init_options (Genesys_Scanner * s) s->opt[OPT_SOURCE].size = max_string_size (source_list); s->opt[OPT_SOURCE].constraint.string_list = source_list; s->val[OPT_SOURCE].s = strdup ("Flatbed"); - /* status = gt68xx_device_get_ta_status (s->dev, &has_ta); - if (status != SANE_STATUS_GOOD || !has_ta) */ DISABLE (OPT_SOURCE); /* preview */ @@ -5026,8 +5013,8 @@ init_options (Genesys_Scanner * s) /* SANE_NAME_FILE is not for buttons */ s->opt[OPT_FILE_SW].name = "file"; - s->opt[OPT_FILE_SW].title = "File button"; - s->opt[OPT_FILE_SW].desc = "File button"; + s->opt[OPT_FILE_SW].title = SANE_I18N("File button"); + s->opt[OPT_FILE_SW].desc = SANE_I18N("File button"); s->opt[OPT_FILE_SW].type = SANE_TYPE_BOOL; s->opt[OPT_FILE_SW].unit = SANE_UNIT_NONE; if (model->buttons & GENESYS_HAS_FILE_SW) @@ -5079,8 +5066,8 @@ init_options (Genesys_Scanner * s) /* OCR button */ s->opt[OPT_OCR_SW].name = "ocr"; - s->opt[OPT_OCR_SW].title = "OCR button"; - s->opt[OPT_OCR_SW].desc = "OCR button"; + s->opt[OPT_OCR_SW].title = SANE_I18N("OCR button"); + s->opt[OPT_OCR_SW].desc = SANE_I18N("OCR button"); s->opt[OPT_OCR_SW].type = SANE_TYPE_BOOL; s->opt[OPT_OCR_SW].unit = SANE_UNIT_NONE; if (model->buttons & GENESYS_HAS_OCR_SW) @@ -5093,8 +5080,8 @@ init_options (Genesys_Scanner * s) /* power button */ s->opt[OPT_POWER_SW].name = "power"; - s->opt[OPT_POWER_SW].title = "Power button"; - s->opt[OPT_POWER_SW].desc = "Power button"; + s->opt[OPT_POWER_SW].title = SANE_I18N("Power button"); + s->opt[OPT_POWER_SW].desc = SANE_I18N("Power button"); s->opt[OPT_POWER_SW].type = SANE_TYPE_BOOL; s->opt[OPT_POWER_SW].unit = SANE_UNIT_NONE; if (model->buttons & GENESYS_HAS_POWER_SW) @@ -5105,15 +5092,21 @@ init_options (Genesys_Scanner * s) s->val[OPT_POWER_SW].b = 0; s->last_val[OPT_POWER_SW].b = 0; + /* button group */ + s->opt[OPT_BUTTON_GROUP].name = "Buttons"; + s->opt[OPT_BUTTON_GROUP].title = SANE_I18N("Buttons"); + s->opt[OPT_BUTTON_GROUP].desc = SANE_I18N("Buttons"); + s->opt[OPT_BUTTON_GROUP].type = SANE_TYPE_GROUP; + s->opt[OPT_BUTTON_GROUP].constraint_type = SANE_CONSTRAINT_NONE; + /* calibrate button */ s->opt[OPT_CALIBRATE].name = "calibrate"; - s->opt[OPT_CALIBRATE].title = "Calibrate button"; - s->opt[OPT_CALIBRATE].desc = "Start calibration using special sheet"; - s->opt[OPT_CALIBRATE].type = SANE_TYPE_BOOL; + s->opt[OPT_CALIBRATE].title = SANE_I18N("Calibrate"); + s->opt[OPT_CALIBRATE].desc = SANE_I18N("Start calibration using special sheet"); + s->opt[OPT_CALIBRATE].type = SANE_TYPE_BUTTON; s->opt[OPT_CALIBRATE].unit = SANE_UNIT_NONE; if (model->buttons & GENESYS_HAS_CALIBRATE) - s->opt[OPT_CALIBRATE].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT - | SANE_CAP_ADVANCED | SANE_CAP_AUTOMATIC; + s->opt[OPT_CALIBRATE].cap = SANE_CAP_SOFT_SELECT | SANE_CAP_ADVANCED | SANE_CAP_AUTOMATIC; else s->opt[OPT_CALIBRATE].cap = SANE_CAP_INACTIVE; s->val[OPT_CALIBRATE].b = 0; @@ -5645,7 +5638,7 @@ get_option_value (Genesys_Scanner * s, int option, void *val) table[i] = s->dev->sensor.blue_gamma_table[i]; } break; - /* buttons */ + /* sensors */ case OPT_SCAN_SW: case OPT_FILE_SW: case OPT_EMAIL_SW: @@ -5657,6 +5650,7 @@ get_option_value (Genesys_Scanner * s, int option, void *val) *(SANE_Bool *) val = s->val[option].b; s->last_val[option].b = *(SANE_Bool *) val; break; + /* button */ default: DBG (DBG_warn, "get_option_value: can't get unknown option %d\n", option); @@ -5854,6 +5848,9 @@ set_option_value (Genesys_Scanner * s, int option, void *val, s->dev->sensor.blue_gamma_table[i] = table[i]; } break; + case OPT_CALIBRATE: + /* TODO call for calibration using special sheet here */ + break; default: DBG (DBG_warn, "set_option_value: can't set unknown option %d\n", diff --git a/backend/genesys.h b/backend/genesys.h index 497d49b24..e16cc6baa 100644 --- a/backend/genesys.h +++ b/backend/genesys.h @@ -103,6 +103,7 @@ enum Genesys_Option OPT_PAGE_LOADED_SW, OPT_OCR_SW, OPT_POWER_SW, + OPT_BUTTON_GROUP, OPT_CALIBRATE, /* must come last: */ diff --git a/backend/genesys_devices.c b/backend/genesys_devices.c index eaf41d073..1f337ff1d 100644 --- a/backend/genesys_devices.c +++ b/backend/genesys_devices.c @@ -943,7 +943,7 @@ Genesys_Model visioneer_xp200_model = { | GENESYS_FLAG_CUSTOM_GAMMA | GENESYS_FLAG_SKIP_WARMUP | GENESYS_FLAG_NO_CALIBRATION, - GENESYS_HAS_SCAN_SW | GENESYS_HAS_PAGE_LOADED_SW, + GENESYS_HAS_SCAN_SW | GENESYS_HAS_PAGE_LOADED_SW | GENESYS_HAS_CALIBRATE, 20, 132 }; @@ -1108,12 +1108,12 @@ static Genesys_Model medion_md5345_model = { NULL, {1200, 600, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible x-resolutions */ - {2400, 1200, 600, 500, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible y-resolutions */ + {2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50, 0}, /* possible y-resolutions */ {16, 8, 0}, /* possible depths in gray mode */ {16, 8, 0}, /* possible depths in color mode */ SANE_FIX ( 4.00), /* Start of scan area in mm (x) */ - SANE_FIX ( 0.00), /* 2.79 < Start of scan area in mm (y) */ + SANE_FIX ( 0.80), /* 2.79 < Start of scan area in mm (y) */ SANE_FIX (215.9), /* Size of scan area in mm (x) */ SANE_FIX (296.4), /* Size of scan area in mm (y) */ diff --git a/backend/genesys_gl646.c b/backend/genesys_gl646.c index 0b935e4c1..c98517557 100644 --- a/backend/genesys_gl646.c +++ b/backend/genesys_gl646.c @@ -1283,10 +1283,10 @@ gl646_setup_registers (Genesys_Device * dev, } /* vfinal=(exposure/(1200/dpi))/step_type */ - DBG (DBG_info, "XXX STEF XXX vfinal=%d, vend1=%d\n", + /* DBG (DBG_info, "XXX STEF XXX vfinal=%d, vend1=%d\n", (sensor->exposure * sensor->xdpi) / ((1 << motor->steptype) * dev->sensor.optical_res), - motor->vend1); + motor->vend1);*/ /* half_ccd if manual clock programming or dpi is half dpiset */ half_ccd = sensor->half_ccd; @@ -1358,7 +1358,10 @@ gl646_setup_registers (Genesys_Device * dev, regs[reg_0x01].value &= ~REG01_FASTMOD; /* allow moving when buffer full by default */ - dev->reg[reg_0x02].value &= ~REG02_ACDCDIS; + if (dev->model->is_sheetfed == SANE_FALSE) + dev->reg[reg_0x02].value &= ~REG02_ACDCDIS; + else + dev->reg[reg_0x02].value |= REG02_ACDCDIS; /* setup motor power */ regs[reg_0x02].value |= REG02_MTRPWR; @@ -1542,15 +1545,25 @@ gl646_setup_registers (Genesys_Device * dev, /* but head has moved due to shading calibration => y_position_in_steps */ if (feedl > 0) { - /* TODO clean up this when I'll fully understand + /* TODO clean up this when I'll fully understand. * for now, special casing each motor */ switch (dev->model->motor_type) { case MOTOR_5345: - if (motor->steptype != QUATER_STEP) - feedl = feedl - motor->steps1; - else - feedl = feedl + 110; /* 90 < */ + switch (motor->ydpi) + { + case 400: /* 32 steps at 1/2 */ + feedl += 255; /* 255-32 < */ + break; + case 600: + break; + case 1200: + break; + case 2400: + break; + default: /* 255 steps at half steps */ + break; + } break; case MOTOR_HP2300: switch (motor->ydpi) @@ -1591,13 +1604,6 @@ gl646_setup_registers (Genesys_Device * dev, feedl = 0; } - /* round move distance according to dummy lines */ - /* XXX STEF XXX if (dev->model->is_cis == SANE_FALSE) - * it is for backtracking - { - dummy = regs[reg_0x1e].value & 0x0f; - move = ((move + dummy) / (dummy + 1)) * (dummy + 1); - } */ DBG (DBG_info, "gl646_setup_registers: final move=%d\n", feedl); gl646_set_triple_reg (regs, REG_FEEDL, feedl); @@ -2691,6 +2697,8 @@ gl646_detect_document_end (Genesys_Device * dev) /* test for document presence */ RIE (sanei_genesys_get_status (dev, &val)); DBG (DBG_info, "gl646_detect_document_end: status=0x%02x\n", val); + status = gl646_gpio_read (dev->dn, &val); + DBG (DBG_info, "gl646_detect_document_end: GPIO=0x%02x\n", val); /* sheetfed scanner uses home sensor as paper present */ if ((dev->document == SANE_TRUE) && (val & REG41_HOMESNR)) @@ -2736,7 +2744,6 @@ gl646_detect_document_end (Genesys_Device * dev) dev->read_bytes_left = bytes_to_flush; } } - return SANE_STATUS_GOOD; } DBG (DBG_proc, "gl646_detect_document_end: end\n"); @@ -2746,7 +2753,7 @@ gl646_detect_document_end (Genesys_Device * dev) /** * eject document from the feeder * currently only used by XP200 - * TODO we currently rely on AGOHOME not being set for shetfed scanners, + * TODO we currently rely on AGOHOME not being set for sheetfed scanners, * maybe check this flag in eject to let the document being eject automaticaly */ static SANE_Status @@ -2892,6 +2899,7 @@ gl646_eject_document (Genesys_Device * dev) do { status = sanei_genesys_get_status (dev, &val); + print_status (val); if (status != SANE_STATUS_GOOD) { DBG (DBG_error, @@ -3381,7 +3389,7 @@ gl646_init_regs_for_shading (Genesys_Device * dev) dev->reg[reg_0x01].value &= ~REG01_DVDSET; dev->reg[reg_0x02].value |= REG02_ACDCDIS; /* ease backtracking */ dev->reg[reg_0x02].value &= ~(REG02_FASTFED | REG02_AGOHOME); - dev->reg[reg_0x02].value &= ~REG02_MTRPWR; + gl646_set_motor_power (dev->reg, SANE_FALSE); /* TODO another flag to setup regs ? */ /* enforce needed LINCNT, getting rid of extra lines for color reordering */ @@ -4102,10 +4110,6 @@ gl646_init_regs_for_warmup (Genesys_Device * dev, /* don't enable gamma correction for this scan */ dev->reg[reg_0x05].value &= ~REG05_GMMENB; - /* copy reg to calib_reg */ - /* XXX STEF XXX memcpy (local_reg, dev->reg, - GENESYS_GL646_MAX_REGS * sizeof (Genesys_Register_Set)); */ - /* turn off motor during this scan */ gl646_set_motor_power (local_reg, SANE_FALSE); @@ -4570,11 +4574,7 @@ simple_scan (Genesys_Device * dev, Genesys_Settings settings, SANE_Bool move, /* wait for buffers to be filled */ do { - /* XXX STEF XXX status = sanei_genesys_get_status (dev, &val); - read_triple_reg (dev, REG_SCANCNT, &lines); - print_status (val); */ RIE (sanei_genesys_test_buffer_empty (dev, &empty)); - /* XXX STEF XXX usleep (10000UL); */ } while (empty); @@ -4597,7 +4597,6 @@ simple_scan (Genesys_Device * dev, Genesys_Settings settings, SANE_Bool move, "simple_scan: failed to end scan: %s\n", sane_strstatus (status)); return status; } - /* XXX STEF XXX usleep (50000UL); */ DBG (DBG_proc, "simple_scan: end\n"); return status; diff --git a/doc/descriptions/lexmark.desc b/doc/descriptions/lexmark.desc index f6bd8ba50..1fc19a962 100644 --- a/doc/descriptions/lexmark.desc +++ b/doc/descriptions/lexmark.desc @@ -42,7 +42,6 @@ :status :untested :model "X1150" -:url "/unsupported/lexmark-x1150.html" :interface "USB" :usbid "0x043d" "0x007c" :status :good