Lines Matching full:dev
2 Copyright (C) 2001-2012 Stéphane Voltz <stef.dev@free.fr>
185 #define UMAX_PP_DEFAULT_PORT "/dev/parport0"
191 * or the device name used by ppdev on linux systems (/dev/parport0 )
198 Umax_PP_Descriptor *dev; in umax_pp_attach() local
289 dev = malloc (sizeof (Umax_PP_Descriptor) * (num_devices + 1)); in umax_pp_attach()
291 if (dev == NULL) in umax_pp_attach()
298 memset (dev, 0, sizeof (Umax_PP_Descriptor) * (num_devices + 1)); in umax_pp_attach()
302 memcpy (dev + 1, devlist, sizeof (Umax_PP_Descriptor) * (num_devices)); in umax_pp_attach()
306 devlist = dev; in umax_pp_attach()
312 dev->sane.name = strdup (devname); in umax_pp_attach()
314 dev->sane.name = strdup (val); in umax_pp_attach()
317 dev->sane.vendor = strdup ("UMAX"); in umax_pp_attach()
319 dev->sane.vendor = strdup (val); in umax_pp_attach()
320 dev->sane.type = "flatbed scanner"; in umax_pp_attach()
323 dev->ppdevice = strdup (devname); in umax_pp_attach()
325 dev->port = strdup (devname); in umax_pp_attach()
326 dev->buf_size = buf_size; in umax_pp_attach()
330 dev->max_res = 1200; in umax_pp_attach()
331 dev->ccd_res = 600; in umax_pp_attach()
332 dev->max_h_size = 5100; in umax_pp_attach()
333 dev->max_v_size = 7000 - 8; /* -8: workaround 'y overflow bug at 600 dpi' */ in umax_pp_attach()
337 dev->max_res = 600; in umax_pp_attach()
338 dev->ccd_res = 300; in umax_pp_attach()
339 dev->max_h_size = 2550; in umax_pp_attach()
340 dev->max_v_size = 3500; in umax_pp_attach()
344 dev->sane.model = strdup (model); in umax_pp_attach()
346 dev->sane.model = strdup (val); in umax_pp_attach()
498 init_options (Umax_PP_Device * dev) in init_options() argument
503 memset (dev->opt, 0, sizeof (dev->opt)); in init_options()
504 memset (dev->val, 0, sizeof (dev->val)); in init_options()
508 dev->opt[i].size = sizeof (SANE_Word); in init_options()
509 dev->opt[i].cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT; in init_options()
512 dev->opt[OPT_NUM_OPTS].name = SANE_NAME_NUM_OPTIONS; in init_options()
513 dev->opt[OPT_NUM_OPTS].title = SANE_TITLE_NUM_OPTIONS; in init_options()
514 dev->opt[OPT_NUM_OPTS].desc = SANE_DESC_NUM_OPTIONS; in init_options()
515 dev->opt[OPT_NUM_OPTS].type = SANE_TYPE_INT; in init_options()
516 dev->opt[OPT_NUM_OPTS].cap = SANE_CAP_SOFT_DETECT; in init_options()
517 dev->val[OPT_NUM_OPTS].w = NUM_OPTIONS; in init_options()
521 dev->opt[OPT_MODE_GROUP].title = SANE_TITLE_SCAN_MODE; in init_options()
522 dev->opt[OPT_MODE_GROUP].name = ""; in init_options()
523 dev->opt[OPT_MODE_GROUP].desc = ""; in init_options()
524 dev->opt[OPT_MODE_GROUP].type = SANE_TYPE_GROUP; in init_options()
525 dev->opt[OPT_MODE_GROUP].size = 0; in init_options()
526 dev->opt[OPT_MODE_GROUP].constraint_type = SANE_CONSTRAINT_NONE; in init_options()
529 dev->opt[OPT_MODE].name = SANE_NAME_SCAN_MODE; in init_options()
530 dev->opt[OPT_MODE].title = SANE_TITLE_SCAN_MODE; in init_options()
531 dev->opt[OPT_MODE].desc = SANE_DESC_SCAN_MODE; in init_options()
532 dev->opt[OPT_MODE].type = SANE_TYPE_STRING; in init_options()
533 dev->opt[OPT_MODE].constraint_type = SANE_CONSTRAINT_STRING_LIST; in init_options()
534 dev->opt[OPT_MODE].size = 10; in init_options()
535 dev->opt[OPT_MODE].constraint.string_list = mode_list; in init_options()
536 dev->val[OPT_MODE].s = strdup (mode_list[1]); in init_options()
539 dev->opt[OPT_RESOLUTION].name = SANE_NAME_SCAN_RESOLUTION; in init_options()
540 dev->opt[OPT_RESOLUTION].title = SANE_TITLE_SCAN_RESOLUTION; in init_options()
541 dev->opt[OPT_RESOLUTION].desc = SANE_DESC_SCAN_RESOLUTION; in init_options()
542 dev->opt[OPT_RESOLUTION].type = SANE_TYPE_FIXED; in init_options()
543 dev->opt[OPT_RESOLUTION].unit = SANE_UNIT_DPI; in init_options()
544 dev->opt[OPT_RESOLUTION].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
545 dev->opt[OPT_RESOLUTION].constraint.range = &dev->dpi_range; in init_options()
546 dev->val[OPT_RESOLUTION].w = dev->dpi_range.min; in init_options()
550 dev->opt[OPT_PREVIEW].name = SANE_NAME_PREVIEW; in init_options()
551 dev->opt[OPT_PREVIEW].title = SANE_TITLE_PREVIEW; in init_options()
552 dev->opt[OPT_PREVIEW].desc = SANE_DESC_PREVIEW; in init_options()
553 dev->opt[OPT_PREVIEW].type = SANE_TYPE_BOOL; in init_options()
554 dev->opt[OPT_PREVIEW].size = sizeof (SANE_Word); in init_options()
555 dev->opt[OPT_PREVIEW].unit = SANE_UNIT_NONE; in init_options()
556 dev->val[OPT_PREVIEW].w = SANE_FALSE; in init_options()
559 dev->opt[OPT_GRAY_PREVIEW].name = SANE_NAME_GRAY_PREVIEW; in init_options()
560 dev->opt[OPT_GRAY_PREVIEW].title = SANE_TITLE_GRAY_PREVIEW; in init_options()
561 dev->opt[OPT_GRAY_PREVIEW].desc = SANE_DESC_GRAY_PREVIEW; in init_options()
562 dev->opt[OPT_GRAY_PREVIEW].type = SANE_TYPE_BOOL; in init_options()
563 dev->opt[OPT_GRAY_PREVIEW].size = sizeof (SANE_Word); in init_options()
564 dev->opt[OPT_GRAY_PREVIEW].unit = SANE_UNIT_NONE; in init_options()
565 dev->val[OPT_GRAY_PREVIEW].w = SANE_FALSE; in init_options()
569 dev->opt[OPT_GEOMETRY_GROUP].title = SANE_I18N ("Geometry"); in init_options()
570 dev->opt[OPT_GEOMETRY_GROUP].desc = ""; in init_options()
571 dev->opt[OPT_GEOMETRY_GROUP].name = ""; in init_options()
572 dev->opt[OPT_GEOMETRY_GROUP].type = SANE_TYPE_GROUP; in init_options()
573 dev->opt[OPT_GEOMETRY_GROUP].size = 0; in init_options()
574 dev->opt[OPT_GEOMETRY_GROUP].constraint_type = SANE_CONSTRAINT_NONE; in init_options()
577 dev->opt[OPT_TL_X].name = SANE_NAME_SCAN_TL_X; in init_options()
578 dev->opt[OPT_TL_X].title = SANE_TITLE_SCAN_TL_X; in init_options()
579 dev->opt[OPT_TL_X].desc = SANE_DESC_SCAN_TL_X; in init_options()
580 dev->opt[OPT_TL_X].type = SANE_TYPE_INT; in init_options()
581 dev->opt[OPT_TL_X].unit = SANE_UNIT_PIXEL; in init_options()
582 dev->opt[OPT_TL_X].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
583 dev->opt[OPT_TL_X].constraint.range = &dev->x_range; in init_options()
584 dev->val[OPT_TL_X].w = 0; in init_options()
587 dev->opt[OPT_TL_Y].name = SANE_NAME_SCAN_TL_Y; in init_options()
588 dev->opt[OPT_TL_Y].title = SANE_TITLE_SCAN_TL_Y; in init_options()
589 dev->opt[OPT_TL_Y].desc = SANE_DESC_SCAN_TL_Y; in init_options()
590 dev->opt[OPT_TL_Y].type = SANE_TYPE_INT; in init_options()
591 dev->opt[OPT_TL_Y].unit = SANE_UNIT_PIXEL; in init_options()
592 dev->opt[OPT_TL_Y].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
593 dev->opt[OPT_TL_Y].constraint.range = &dev->y_range; in init_options()
594 dev->val[OPT_TL_Y].w = 0; in init_options()
597 dev->opt[OPT_BR_X].name = SANE_NAME_SCAN_BR_X; in init_options()
598 dev->opt[OPT_BR_X].title = SANE_TITLE_SCAN_BR_X; in init_options()
599 dev->opt[OPT_BR_X].desc = SANE_DESC_SCAN_BR_X; in init_options()
600 dev->opt[OPT_BR_X].type = SANE_TYPE_INT; in init_options()
601 dev->opt[OPT_BR_X].unit = SANE_UNIT_PIXEL; in init_options()
602 dev->opt[OPT_BR_X].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
603 dev->opt[OPT_BR_X].constraint.range = &dev->x_range; in init_options()
604 dev->val[OPT_BR_X].w = dev->x_range.max; in init_options()
607 dev->opt[OPT_BR_Y].name = SANE_NAME_SCAN_BR_Y; in init_options()
608 dev->opt[OPT_BR_Y].title = SANE_TITLE_SCAN_BR_Y; in init_options()
609 dev->opt[OPT_BR_Y].desc = SANE_DESC_SCAN_BR_Y; in init_options()
610 dev->opt[OPT_BR_Y].type = SANE_TYPE_INT; in init_options()
611 dev->opt[OPT_BR_Y].unit = SANE_UNIT_PIXEL; in init_options()
612 dev->opt[OPT_BR_Y].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
613 dev->opt[OPT_BR_Y].constraint.range = &dev->y_range; in init_options()
614 dev->val[OPT_BR_Y].w = dev->y_range.max; in init_options()
618 dev->opt[OPT_ENHANCEMENT_GROUP].title = SANE_I18N ("Enhancement"); in init_options()
619 dev->opt[OPT_ENHANCEMENT_GROUP].desc = ""; in init_options()
620 dev->opt[OPT_ENHANCEMENT_GROUP].name = ""; in init_options()
621 dev->opt[OPT_ENHANCEMENT_GROUP].type = SANE_TYPE_GROUP; in init_options()
622 dev->opt[OPT_ENHANCEMENT_GROUP].size = 0; in init_options()
623 dev->opt[OPT_ENHANCEMENT_GROUP].cap |= SANE_CAP_ADVANCED; in init_options()
624 dev->opt[OPT_ENHANCEMENT_GROUP].constraint_type = SANE_CONSTRAINT_NONE; in init_options()
627 dev->opt[OPT_LAMP_CONTROL].name = "lamp-control"; in init_options()
628 dev->opt[OPT_LAMP_CONTROL].title = SANE_I18N ("Lamp on"); in init_options()
629 dev->opt[OPT_LAMP_CONTROL].desc = SANE_I18N ("Sets lamp on/off"); in init_options()
630 dev->opt[OPT_LAMP_CONTROL].type = SANE_TYPE_BOOL; in init_options()
631 dev->opt[OPT_LAMP_CONTROL].size = sizeof (SANE_Word); in init_options()
632 dev->opt[OPT_LAMP_CONTROL].unit = SANE_UNIT_NONE; in init_options()
633 dev->val[OPT_LAMP_CONTROL].w = SANE_TRUE; in init_options()
634 dev->opt[OPT_LAMP_CONTROL].cap |= SANE_CAP_ADVANCED; in init_options()
637 dev->opt[OPT_UTA_CONTROL].name = "UTA-control"; in init_options()
638 dev->opt[OPT_UTA_CONTROL].title = SANE_I18N ("UTA on"); in init_options()
639 dev->opt[OPT_UTA_CONTROL].desc = SANE_I18N ("Sets UTA on/off"); in init_options()
640 dev->opt[OPT_UTA_CONTROL].type = SANE_TYPE_BOOL; in init_options()
641 dev->opt[OPT_UTA_CONTROL].size = sizeof (SANE_Word); in init_options()
642 dev->opt[OPT_UTA_CONTROL].unit = SANE_UNIT_NONE; in init_options()
643 dev->val[OPT_UTA_CONTROL].w = SANE_TRUE; in init_options()
644 dev->opt[OPT_UTA_CONTROL].cap |= SANE_CAP_ADVANCED | SANE_CAP_INACTIVE; in init_options()
647 dev->opt[OPT_CUSTOM_GAMMA].name = SANE_NAME_CUSTOM_GAMMA; in init_options()
648 dev->opt[OPT_CUSTOM_GAMMA].title = SANE_TITLE_CUSTOM_GAMMA; in init_options()
649 dev->opt[OPT_CUSTOM_GAMMA].desc = SANE_DESC_CUSTOM_GAMMA; in init_options()
650 dev->opt[OPT_CUSTOM_GAMMA].type = SANE_TYPE_BOOL; in init_options()
651 dev->opt[OPT_CUSTOM_GAMMA].cap |= SANE_CAP_ADVANCED; in init_options()
652 dev->val[OPT_CUSTOM_GAMMA].w = SANE_FALSE; in init_options()
655 dev->opt[OPT_GAMMA_VECTOR].name = SANE_NAME_GAMMA_VECTOR; in init_options()
656 dev->opt[OPT_GAMMA_VECTOR].title = SANE_TITLE_GAMMA_VECTOR; in init_options()
657 dev->opt[OPT_GAMMA_VECTOR].desc = SANE_DESC_GAMMA_VECTOR; in init_options()
658 dev->opt[OPT_GAMMA_VECTOR].type = SANE_TYPE_INT; in init_options()
659 dev->opt[OPT_GAMMA_VECTOR].cap |= SANE_CAP_INACTIVE; in init_options()
660 dev->opt[OPT_GAMMA_VECTOR].unit = SANE_UNIT_NONE; in init_options()
661 dev->opt[OPT_GAMMA_VECTOR].size = 256 * sizeof (SANE_Word); in init_options()
662 dev->opt[OPT_GAMMA_VECTOR].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
663 dev->opt[OPT_GAMMA_VECTOR].constraint.range = &u8_range; in init_options()
664 dev->val[OPT_GAMMA_VECTOR].wa = &dev->gamma_table[0][0]; in init_options()
667 dev->opt[OPT_GAMMA_VECTOR_R].name = SANE_NAME_GAMMA_VECTOR_R; in init_options()
668 dev->opt[OPT_GAMMA_VECTOR_R].title = SANE_TITLE_GAMMA_VECTOR_R; in init_options()
669 dev->opt[OPT_GAMMA_VECTOR_R].desc = SANE_DESC_GAMMA_VECTOR_R; in init_options()
670 dev->opt[OPT_GAMMA_VECTOR_R].type = SANE_TYPE_INT; in init_options()
671 dev->opt[OPT_GAMMA_VECTOR_R].cap |= SANE_CAP_INACTIVE; in init_options()
672 dev->opt[OPT_GAMMA_VECTOR_R].unit = SANE_UNIT_NONE; in init_options()
673 dev->opt[OPT_GAMMA_VECTOR_R].size = 256 * sizeof (SANE_Word); in init_options()
674 dev->opt[OPT_GAMMA_VECTOR_R].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
675 dev->opt[OPT_GAMMA_VECTOR_R].constraint.range = &u8_range; in init_options()
676 dev->val[OPT_GAMMA_VECTOR_R].wa = &dev->gamma_table[1][0]; in init_options()
679 dev->opt[OPT_GAMMA_VECTOR_G].name = SANE_NAME_GAMMA_VECTOR_G; in init_options()
680 dev->opt[OPT_GAMMA_VECTOR_G].title = SANE_TITLE_GAMMA_VECTOR_G; in init_options()
681 dev->opt[OPT_GAMMA_VECTOR_G].desc = SANE_DESC_GAMMA_VECTOR_G; in init_options()
682 dev->opt[OPT_GAMMA_VECTOR_G].type = SANE_TYPE_INT; in init_options()
683 dev->opt[OPT_GAMMA_VECTOR_G].cap |= SANE_CAP_INACTIVE; in init_options()
684 dev->opt[OPT_GAMMA_VECTOR_G].unit = SANE_UNIT_NONE; in init_options()
685 dev->opt[OPT_GAMMA_VECTOR_G].size = 256 * sizeof (SANE_Word); in init_options()
686 dev->opt[OPT_GAMMA_VECTOR_G].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
687 dev->opt[OPT_GAMMA_VECTOR_G].constraint.range = &u8_range; in init_options()
688 dev->val[OPT_GAMMA_VECTOR_G].wa = &dev->gamma_table[2][0]; in init_options()
691 dev->opt[OPT_GAMMA_VECTOR_B].name = SANE_NAME_GAMMA_VECTOR_B; in init_options()
692 dev->opt[OPT_GAMMA_VECTOR_B].title = SANE_TITLE_GAMMA_VECTOR_B; in init_options()
693 dev->opt[OPT_GAMMA_VECTOR_B].desc = SANE_DESC_GAMMA_VECTOR_B; in init_options()
694 dev->opt[OPT_GAMMA_VECTOR_B].type = SANE_TYPE_INT; in init_options()
695 dev->opt[OPT_GAMMA_VECTOR_B].cap |= SANE_CAP_INACTIVE; in init_options()
696 dev->opt[OPT_GAMMA_VECTOR_B].unit = SANE_UNIT_NONE; in init_options()
697 dev->opt[OPT_GAMMA_VECTOR_B].size = 256 * sizeof (SANE_Word); in init_options()
698 dev->opt[OPT_GAMMA_VECTOR_B].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
699 dev->opt[OPT_GAMMA_VECTOR_B].constraint.range = &u8_range; in init_options()
700 dev->val[OPT_GAMMA_VECTOR_B].wa = &dev->gamma_table[3][0]; in init_options()
703 dev->opt[OPT_MANUAL_GAIN].name = "manual-channel-gain"; in init_options()
704 dev->opt[OPT_MANUAL_GAIN].title = SANE_I18N ("Gain"); in init_options()
705 dev->opt[OPT_MANUAL_GAIN].desc = SANE_I18N ("Color channels gain settings"); in init_options()
706 dev->opt[OPT_MANUAL_GAIN].type = SANE_TYPE_BOOL; in init_options()
707 dev->opt[OPT_MANUAL_GAIN].cap |= SANE_CAP_ADVANCED; in init_options()
708 dev->val[OPT_MANUAL_GAIN].w = SANE_FALSE; in init_options()
711 dev->opt[OPT_GRAY_GAIN].name = "gray-gain"; in init_options()
712 dev->opt[OPT_GRAY_GAIN].title = SANE_I18N ("Gray gain"); in init_options()
713 dev->opt[OPT_GRAY_GAIN].desc = SANE_I18N ("Sets gray channel gain"); in init_options()
714 dev->opt[OPT_GRAY_GAIN].type = SANE_TYPE_INT; in init_options()
715 dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; in init_options()
716 dev->opt[OPT_GRAY_GAIN].unit = SANE_UNIT_NONE; in init_options()
717 dev->opt[OPT_GRAY_GAIN].size = sizeof (SANE_Int); in init_options()
718 dev->opt[OPT_GRAY_GAIN].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
719 dev->opt[OPT_GRAY_GAIN].constraint.range = &u4_range; in init_options()
720 dev->val[OPT_GRAY_GAIN].w = dev->gray_gain; in init_options()
723 dev->opt[OPT_RED_GAIN].name = "red-gain"; in init_options()
724 dev->opt[OPT_RED_GAIN].title = SANE_I18N ("Red gain"); in init_options()
725 dev->opt[OPT_RED_GAIN].desc = SANE_I18N ("Sets red channel gain"); in init_options()
726 dev->opt[OPT_RED_GAIN].type = SANE_TYPE_INT; in init_options()
727 dev->opt[OPT_RED_GAIN].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; in init_options()
728 dev->opt[OPT_RED_GAIN].unit = SANE_UNIT_NONE; in init_options()
729 dev->opt[OPT_RED_GAIN].size = sizeof (SANE_Int); in init_options()
730 dev->opt[OPT_RED_GAIN].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
731 dev->opt[OPT_RED_GAIN].constraint.range = &u4_range; in init_options()
732 dev->val[OPT_RED_GAIN].w = dev->red_gain; in init_options()
735 dev->opt[OPT_GREEN_GAIN].name = "green-gain"; in init_options()
736 dev->opt[OPT_GREEN_GAIN].title = SANE_I18N ("Green gain"); in init_options()
737 dev->opt[OPT_GREEN_GAIN].desc = SANE_I18N ("Sets green channel gain"); in init_options()
738 dev->opt[OPT_GREEN_GAIN].type = SANE_TYPE_INT; in init_options()
739 dev->opt[OPT_GREEN_GAIN].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; in init_options()
740 dev->opt[OPT_GREEN_GAIN].unit = SANE_UNIT_NONE; in init_options()
741 dev->opt[OPT_GREEN_GAIN].size = sizeof (SANE_Int); in init_options()
742 dev->opt[OPT_GREEN_GAIN].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
743 dev->opt[OPT_GREEN_GAIN].constraint.range = &u4_range; in init_options()
744 dev->val[OPT_GREEN_GAIN].w = dev->green_gain; in init_options()
747 dev->opt[OPT_BLUE_GAIN].name = "blue-gain"; in init_options()
748 dev->opt[OPT_BLUE_GAIN].title = SANE_I18N ("Blue gain"); in init_options()
749 dev->opt[OPT_BLUE_GAIN].desc = SANE_I18N ("Sets blue channel gain"); in init_options()
750 dev->opt[OPT_BLUE_GAIN].type = SANE_TYPE_INT; in init_options()
751 dev->opt[OPT_BLUE_GAIN].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; in init_options()
752 dev->opt[OPT_BLUE_GAIN].unit = SANE_UNIT_NONE; in init_options()
753 dev->opt[OPT_BLUE_GAIN].size = sizeof (SANE_Int); in init_options()
754 dev->opt[OPT_BLUE_GAIN].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
755 dev->opt[OPT_BLUE_GAIN].constraint.range = &u4_range; in init_options()
756 dev->val[OPT_BLUE_GAIN].w = dev->blue_gain; in init_options()
759 dev->opt[OPT_MANUAL_OFFSET].name = "manual-offset"; in init_options()
760 dev->opt[OPT_MANUAL_OFFSET].title = SANE_I18N ("Offset"); in init_options()
761 dev->opt[OPT_MANUAL_OFFSET].desc = in init_options()
763 dev->opt[OPT_MANUAL_OFFSET].type = SANE_TYPE_BOOL; in init_options()
764 dev->opt[OPT_MANUAL_OFFSET].cap |= SANE_CAP_ADVANCED; in init_options()
765 dev->val[OPT_MANUAL_OFFSET].w = SANE_FALSE; in init_options()
768 dev->opt[OPT_GRAY_OFFSET].name = "gray-offset"; in init_options()
769 dev->opt[OPT_GRAY_OFFSET].title = SANE_I18N ("Gray offset"); in init_options()
770 dev->opt[OPT_GRAY_OFFSET].desc = SANE_I18N ("Sets gray channel offset"); in init_options()
771 dev->opt[OPT_GRAY_OFFSET].type = SANE_TYPE_INT; in init_options()
772 dev->opt[OPT_GRAY_OFFSET].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; in init_options()
773 dev->opt[OPT_GRAY_OFFSET].unit = SANE_UNIT_NONE; in init_options()
774 dev->opt[OPT_GRAY_OFFSET].size = sizeof (SANE_Int); in init_options()
775 dev->opt[OPT_GRAY_OFFSET].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
776 dev->opt[OPT_GRAY_OFFSET].constraint.range = &u4_range; in init_options()
777 dev->val[OPT_GRAY_OFFSET].w = dev->gray_offset; in init_options()
780 dev->opt[OPT_RED_OFFSET].name = "red-offset"; in init_options()
781 dev->opt[OPT_RED_OFFSET].title = SANE_I18N ("Red offset"); in init_options()
782 dev->opt[OPT_RED_OFFSET].desc = SANE_I18N ("Sets red channel offset"); in init_options()
783 dev->opt[OPT_RED_OFFSET].type = SANE_TYPE_INT; in init_options()
784 dev->opt[OPT_RED_OFFSET].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; in init_options()
785 dev->opt[OPT_RED_OFFSET].unit = SANE_UNIT_NONE; in init_options()
786 dev->opt[OPT_RED_OFFSET].size = sizeof (SANE_Int); in init_options()
787 dev->opt[OPT_RED_OFFSET].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
788 dev->opt[OPT_RED_OFFSET].constraint.range = &u4_range; in init_options()
789 dev->val[OPT_RED_OFFSET].w = dev->red_offset; in init_options()
792 dev->opt[OPT_GREEN_OFFSET].name = "green-offset"; in init_options()
793 dev->opt[OPT_GREEN_OFFSET].title = SANE_I18N ("Green offset"); in init_options()
794 dev->opt[OPT_GREEN_OFFSET].desc = SANE_I18N ("Sets green channel offset"); in init_options()
795 dev->opt[OPT_GREEN_OFFSET].type = SANE_TYPE_INT; in init_options()
796 dev->opt[OPT_GREEN_OFFSET].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; in init_options()
797 dev->opt[OPT_GREEN_OFFSET].unit = SANE_UNIT_NONE; in init_options()
798 dev->opt[OPT_GREEN_OFFSET].size = sizeof (SANE_Int); in init_options()
799 dev->opt[OPT_GREEN_OFFSET].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
800 dev->opt[OPT_GREEN_OFFSET].constraint.range = &u4_range; in init_options()
801 dev->val[OPT_GREEN_OFFSET].w = dev->green_offset; in init_options()
804 dev->opt[OPT_BLUE_OFFSET].name = "blue-offset"; in init_options()
805 dev->opt[OPT_BLUE_OFFSET].title = SANE_I18N ("Blue offset"); in init_options()
806 dev->opt[OPT_BLUE_OFFSET].desc = SANE_I18N ("Sets blue channel offset"); in init_options()
807 dev->opt[OPT_BLUE_OFFSET].type = SANE_TYPE_INT; in init_options()
808 dev->opt[OPT_BLUE_OFFSET].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED; in init_options()
809 dev->opt[OPT_BLUE_OFFSET].unit = SANE_UNIT_NONE; in init_options()
810 dev->opt[OPT_BLUE_OFFSET].size = sizeof (SANE_Int); in init_options()
811 dev->opt[OPT_BLUE_OFFSET].constraint_type = SANE_CONSTRAINT_RANGE; in init_options()
812 dev->opt[OPT_BLUE_OFFSET].constraint.range = &u4_range; in init_options()
813 dev->val[OPT_BLUE_OFFSET].w = dev->blue_offset; in init_options()
978 Umax_PP_Device *dev; in sane_exit() local
986 dev = first_dev; in sane_exit()
987 sane_close (dev); in sane_exit()
1059 Umax_PP_Device *dev; in sane_open() local
1172 dev = (Umax_PP_Device *) malloc (sizeof (*dev)); in sane_open()
1174 if (dev == NULL) in sane_open()
1181 memset (dev, 0, sizeof (*dev)); in sane_open()
1183 dev->desc = desc; in sane_open()
1187 dev->gamma_table[i][j] = j; in sane_open()
1191 dev->buf = malloc (dev->desc->buf_size + UMAX_PP_RESERVE); in sane_open()
1192 dev->bufsize = dev->desc->buf_size; in sane_open()
1194 dev->dpi_range.min = SANE_FIX (75); in sane_open()
1195 dev->dpi_range.max = SANE_FIX (dev->desc->max_res); in sane_open()
1196 dev->dpi_range.quant = 0; in sane_open()
1198 dev->x_range.min = 0; in sane_open()
1199 dev->x_range.max = dev->desc->max_h_size; in sane_open()
1200 dev->x_range.quant = 0; in sane_open()
1202 dev->y_range.min = 0; in sane_open()
1203 dev->y_range.max = dev->desc->max_v_size; in sane_open()
1204 dev->y_range.quant = 0; in sane_open()
1206 dev->gray_gain = 0; in sane_open()
1209 dev->red_gain = red_gain; in sane_open()
1210 dev->green_gain = green_gain; in sane_open()
1211 dev->blue_gain = blue_gain; in sane_open()
1212 dev->red_offset = red_offset; in sane_open()
1213 dev->green_offset = green_offset; in sane_open()
1214 dev->blue_offset = blue_offset; in sane_open()
1217 if (dev->buf == NULL) in sane_open()
1220 (long int) dev->desc->buf_size); in sane_open()
1222 free (dev); in sane_open()
1226 init_options (dev); in sane_open()
1228 dev->next = first_dev; in sane_open()
1229 first_dev = dev; in sane_open()
1233 dev->opt[OPT_UTA_CONTROL].cap &= ~SANE_CAP_INACTIVE; in sane_open()
1235 *handle = dev; in sane_open()
1245 Umax_PP_Device *prev, *dev; in sane_close() local
1252 for (dev = first_dev; dev; dev = dev->next) in sane_close()
1254 if (dev == handle) in sane_close()
1256 prev = dev; in sane_close()
1259 if (dev == NULL) in sane_close()
1266 if (dev->state == UMAX_PP_STATE_SCANNING) in sane_close()
1272 while (dev->state == UMAX_PP_STATE_CANCELLED) in sane_close()
1281 dev->state = UMAX_PP_STATE_IDLE; in sane_close()
1286 if (dev->val[OPT_LAMP_CONTROL].w == SANE_TRUE) in sane_close()
1300 prev->next = dev->next; in sane_close()
1302 first_dev = dev->next; in sane_close()
1304 free (dev->buf); in sane_close()
1314 Umax_PP_Device *dev = handle; in sane_get_option_descriptor() local
1324 option, dev->opt[option].name); in sane_get_option_descriptor()
1326 return dev->opt + option; in sane_get_option_descriptor()
1333 Umax_PP_Device *dev = handle; in sane_control_option() local
1343 if (dev->state == UMAX_PP_STATE_SCANNING) in sane_control_option()
1356 cap = dev->opt[option].cap; in sane_control_option()
1365 dev->opt[option].name, action); in sane_control_option()
1395 *(SANE_Word *) val = dev->val[option].w; in sane_control_option()
1403 memcpy (val, dev->val[option].wa, dev->opt[option].size); in sane_control_option()
1409 strcpy (val, dev->val[option].s); in sane_control_option()
1423 status = sanei_constrain_value (dev->opt + option, val, info); in sane_control_option()
1464 dev->val[option].w = *(SANE_Word *) val; in sane_control_option()
1466 if (dev->val[OPT_BR_Y].w < dev->val[OPT_TL_Y].w) in sane_control_option()
1468 tmpw = dev->val[OPT_BR_Y].w; in sane_control_option()
1469 dev->val[OPT_BR_Y].w = dev->val[OPT_TL_Y].w; in sane_control_option()
1470 dev->val[OPT_TL_Y].w = tmpw; in sane_control_option()
1475 if (strcmp (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0) in sane_control_option()
1477 dpi = (int) (SANE_UNFIX (dev->val[OPT_RESOLUTION].w)); in sane_control_option()
1478 if (dev->val[OPT_TL_Y].w < 2 * umax_pp_get_sync (dpi)) in sane_control_option()
1481 dev->val[OPT_TL_Y].w = 2 * umax_pp_get_sync (dpi); in sane_control_option()
1494 memcpy (dev->val[option].wa, val, dev->opt[option].size); in sane_control_option()
1500 dev->val[option].w = *(SANE_Word *) val; in sane_control_option()
1504 if (dev->state != UMAX_PP_STATE_IDLE) in sane_control_option()
1516 dev->state = UMAX_PP_STATE_IDLE; in sane_control_option()
1518 dev->val[option].w = *(SANE_Word *) val; in sane_control_option()
1519 if (dev->val[option].w == SANE_TRUE) in sane_control_option()
1531 dpi = (int) (SANE_UNFIX (dev->val[OPT_RESOLUTION].w)); in sane_control_option()
1532 dev->val[option].w = *(SANE_Word *) val; in sane_control_option()
1537 if (dev->val[option].w & 0x03) in sane_control_option()
1541 dev->val[option].w = dev->val[option].w & 0xFFFC; in sane_control_option()
1542 *(SANE_Word *) val = dev->val[option].w; in sane_control_option()
1548 if (dev->val[OPT_BR_X].w < dev->val[OPT_TL_X].w) in sane_control_option()
1550 tmpw = dev->val[OPT_BR_X].w; in sane_control_option()
1551 dev->val[OPT_BR_X].w = dev->val[OPT_TL_X].w; in sane_control_option()
1552 dev->val[OPT_TL_X].w = tmpw; in sane_control_option()
1584 dev->val[option].w = *(SANE_Word *) val; in sane_control_option()
1589 dev->val[OPT_TL_X].w = dev->val[OPT_TL_X].w & 0xFFFC; in sane_control_option()
1590 dev->val[OPT_BR_X].w = dev->val[OPT_BR_X].w & 0xFFFC; in sane_control_option()
1593 if (strcmp (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) == 0) in sane_control_option()
1595 if (dev->val[OPT_TL_Y].w < 2 * umax_pp_get_sync (dpi)) in sane_control_option()
1598 dev->val[OPT_TL_Y].w = 2 * umax_pp_get_sync (dpi); in sane_control_option()
1608 if (w == dev->val[OPT_MANUAL_OFFSET].w) in sane_control_option()
1614 dev->val[OPT_MANUAL_OFFSET].w = w; in sane_control_option()
1618 const char *mode = dev->val[OPT_MODE].s; in sane_control_option()
1622 dev->opt[OPT_GRAY_OFFSET].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1625 dev->opt[OPT_GRAY_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1626 dev->opt[OPT_RED_OFFSET].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1627 dev->opt[OPT_GREEN_OFFSET].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1628 dev->opt[OPT_BLUE_OFFSET].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1633 dev->opt[OPT_GRAY_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1634 dev->opt[OPT_RED_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1635 dev->opt[OPT_GREEN_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1636 dev->opt[OPT_BLUE_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1645 if (w == dev->val[OPT_MANUAL_GAIN].w) in sane_control_option()
1651 dev->val[OPT_MANUAL_GAIN].w = w; in sane_control_option()
1655 const char *mode = dev->val[OPT_MODE].s; in sane_control_option()
1659 dev->opt[OPT_GRAY_GAIN].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1662 dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1663 dev->opt[OPT_RED_GAIN].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1664 dev->opt[OPT_GREEN_GAIN].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1665 dev->opt[OPT_BLUE_GAIN].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1670 dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1671 dev->opt[OPT_RED_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1672 dev->opt[OPT_GREEN_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1673 dev->opt[OPT_BLUE_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1683 if (w == dev->val[OPT_CUSTOM_GAMMA].w) in sane_control_option()
1689 dev->val[OPT_CUSTOM_GAMMA].w = w; in sane_control_option()
1693 const char *mode = dev->val[OPT_MODE].s; in sane_control_option()
1698 dev->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1699 sanei_umax_pp_gamma (NULL, dev->val[OPT_GAMMA_VECTOR].wa, in sane_control_option()
1704 dev->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1705 dev->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1706 dev->opt[OPT_GAMMA_VECTOR_G].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1707 dev->opt[OPT_GAMMA_VECTOR_B].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1708 sanei_umax_pp_gamma (dev->val[OPT_GAMMA_VECTOR_R].wa, in sane_control_option()
1709 dev->val[OPT_GAMMA_VECTOR_G].wa, in sane_control_option()
1710 dev->val[OPT_GAMMA_VECTOR_B].wa); in sane_control_option()
1715 dev->opt[OPT_GAMMA_VECTOR].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1716 dev->opt[OPT_GAMMA_VECTOR_R].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1717 dev->opt[OPT_GAMMA_VECTOR_G].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1718 dev->opt[OPT_GAMMA_VECTOR_B].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1726 char *old_val = dev->val[option].s; in sane_control_option()
1739 dev->val[option].s = strdup (val); in sane_control_option()
1744 dpi = (int) (SANE_UNFIX (dev->val[OPT_RESOLUTION].w)); in sane_control_option()
1745 if (dev->val[OPT_TL_Y].w < 2 * umax_pp_get_sync (dpi)) in sane_control_option()
1747 dev->val[OPT_TL_Y].w = 2 * umax_pp_get_sync (dpi); in sane_control_option()
1754 dev->opt[OPT_CUSTOM_GAMMA].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1755 dev->opt[OPT_GAMMA_VECTOR].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1756 dev->opt[OPT_GAMMA_VECTOR_R].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1757 dev->opt[OPT_GAMMA_VECTOR_G].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1758 dev->opt[OPT_GAMMA_VECTOR_B].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1762 if (dev->val[OPT_CUSTOM_GAMMA].w == SANE_TRUE) in sane_control_option()
1767 dev->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1768 sanei_umax_pp_gamma (NULL, dev->val[OPT_GAMMA_VECTOR].wa, in sane_control_option()
1773 dev->opt[OPT_GAMMA_VECTOR].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1774 dev->opt[OPT_GAMMA_VECTOR_R].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1775 dev->opt[OPT_GAMMA_VECTOR_G].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1776 dev->opt[OPT_GAMMA_VECTOR_B].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1777 sanei_umax_pp_gamma (dev->val[OPT_GAMMA_VECTOR_R].wa, in sane_control_option()
1778 dev->val[OPT_GAMMA_VECTOR_G].wa, in sane_control_option()
1779 dev->val[OPT_GAMMA_VECTOR_B].wa); in sane_control_option()
1784 dev->opt[OPT_GRAY_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1785 dev->opt[OPT_RED_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1786 dev->opt[OPT_GREEN_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1787 dev->opt[OPT_BLUE_OFFSET].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1790 if (dev->val[OPT_MANUAL_OFFSET].w == SANE_TRUE) in sane_control_option()
1794 dev->opt[OPT_GRAY_OFFSET].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1797 dev->opt[OPT_RED_OFFSET].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1798 dev->opt[OPT_GREEN_OFFSET].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1799 dev->opt[OPT_BLUE_OFFSET].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1804 dev->opt[OPT_GRAY_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1805 dev->opt[OPT_RED_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1806 dev->opt[OPT_GREEN_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1807 dev->opt[OPT_BLUE_GAIN].cap |= SANE_CAP_INACTIVE; in sane_control_option()
1810 if (dev->val[OPT_MANUAL_GAIN].w == SANE_TRUE) in sane_control_option()
1814 dev->opt[OPT_GRAY_GAIN].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1817 dev->opt[OPT_RED_GAIN].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1818 dev->opt[OPT_GREEN_GAIN].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1819 dev->opt[OPT_BLUE_GAIN].cap &= ~SANE_CAP_INACTIVE; in sane_control_option()
1837 Umax_PP_Device *dev = handle; in sane_get_parameters() local
1840 memset (&(dev->params), 0, sizeof (dev->params)); in sane_get_parameters()
1844 if (strcmp (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_COLOR) != 0) in sane_get_parameters()
1846 if (strcmp (dev->val[OPT_MODE].s, SANE_VALUE_SCAN_MODE_GRAY) != 0) in sane_get_parameters()
1847 dev->color = UMAX_PP_MODE_LINEART; in sane_get_parameters()
1849 dev->color = UMAX_PP_MODE_GRAYSCALE; in sane_get_parameters()
1852 dev->color = UMAX_PP_MODE_COLOR; in sane_get_parameters()
1855 if (dev->val[OPT_MANUAL_OFFSET].w == SANE_TRUE) in sane_get_parameters()
1857 if (dev->color != UMAX_PP_MODE_COLOR) in sane_get_parameters()
1859 dev->red_offset = 0; in sane_get_parameters()
1860 dev->green_offset = (int) (dev->val[OPT_GRAY_OFFSET].w); in sane_get_parameters()
1861 dev->blue_offset = 0; in sane_get_parameters()
1865 dev->red_offset = (int) (dev->val[OPT_RED_OFFSET].w); in sane_get_parameters()
1866 dev->green_offset = (int) (dev->val[OPT_GREEN_OFFSET].w); in sane_get_parameters()
1867 dev->blue_offset = (int) (dev->val[OPT_BLUE_OFFSET].w); in sane_get_parameters()
1872 dev->red_offset = 6; in sane_get_parameters()
1873 dev->green_offset = 6; in sane_get_parameters()
1874 dev->blue_offset = 6; in sane_get_parameters()
1878 if (dev->val[OPT_MANUAL_GAIN].w == SANE_TRUE) in sane_get_parameters()
1880 if (dev->color != UMAX_PP_MODE_COLOR) in sane_get_parameters()
1882 dev->red_gain = 0; in sane_get_parameters()
1883 dev->green_gain = (int) (dev->val[OPT_GRAY_GAIN].w); in sane_get_parameters()
1884 dev->blue_gain = 0; in sane_get_parameters()
1888 dev->red_gain = (int) (dev->val[OPT_RED_GAIN].w); in sane_get_parameters()
1889 dev->green_gain = (int) (dev->val[OPT_GREEN_GAIN].w); in sane_get_parameters()
1890 dev->blue_gain = (int) (dev->val[OPT_BLUE_GAIN].w); in sane_get_parameters()
1895 dev->red_gain = red_gain; in sane_get_parameters()
1896 dev->green_gain = green_gain; in sane_get_parameters()
1897 dev->blue_gain = blue_gain; in sane_get_parameters()
1901 dev->TopX = dev->val[OPT_TL_X].w; in sane_get_parameters()
1902 dev->TopY = dev->val[OPT_TL_Y].w; in sane_get_parameters()
1903 dev->BottomX = dev->val[OPT_BR_X].w; in sane_get_parameters()
1904 dev->BottomY = dev->val[OPT_BR_Y].w; in sane_get_parameters()
1907 dpi = (int) (SANE_UNFIX (dev->val[OPT_RESOLUTION].w)); in sane_get_parameters()
1918 dev->dpi = dpi; in sane_get_parameters()
1925 remain = (dev->BottomX - dev->TopX) & 0x03; in sane_get_parameters()
1929 dev->BottomX, dev->TopX, remain); in sane_get_parameters()
1930 if (dev->BottomX + remain < dev->desc->max_h_size) in sane_get_parameters()
1931 dev->BottomX += remain; in sane_get_parameters()
1934 remain -= (dev->desc->max_h_size - dev->BottomX); in sane_get_parameters()
1935 dev->BottomX = dev->desc->max_h_size; in sane_get_parameters()
1936 dev->TopX -= remain; in sane_get_parameters()
1941 if (dev->val[OPT_PREVIEW].w == SANE_TRUE) in sane_get_parameters()
1944 if (dev->val[OPT_GRAY_PREVIEW].w == SANE_TRUE) in sane_get_parameters()
1947 dev->color = UMAX_PP_MODE_GRAYSCALE; in sane_get_parameters()
1948 dev->params.format = SANE_FRAME_GRAY; in sane_get_parameters()
1953 dev->color = UMAX_PP_MODE_COLOR; in sane_get_parameters()
1954 dev->params.format = SANE_FRAME_RGB; in sane_get_parameters()
1957 dev->dpi = 75; in sane_get_parameters()
1958 dev->TopX = 0; in sane_get_parameters()
1959 dev->TopY = 0; in sane_get_parameters()
1960 dev->BottomX = dev->desc->max_h_size; in sane_get_parameters()
1961 dev->BottomY = dev->desc->max_v_size; in sane_get_parameters()
1966 dev->params.last_frame = SANE_TRUE; in sane_get_parameters()
1967 dev->params.lines = in sane_get_parameters()
1968 ((dev->BottomY - dev->TopY) * dev->dpi) / dev->desc->ccd_res; in sane_get_parameters()
1969 if (dev->dpi >= dev->desc->ccd_res) in sane_get_parameters()
1970 dpi = dev->desc->ccd_res; in sane_get_parameters()
1972 dpi = dev->dpi; in sane_get_parameters()
1973 dev->params.pixels_per_line = in sane_get_parameters()
1974 ((dev->BottomX - dev->TopX) * dpi) / dev->desc->ccd_res; in sane_get_parameters()
1975 if (dev->color == UMAX_PP_MODE_COLOR) in sane_get_parameters()
1977 dev->params.bytes_per_line = dev->params.pixels_per_line * 3; in sane_get_parameters()
1978 dev->params.format = SANE_FRAME_RGB; in sane_get_parameters()
1982 dev->params.bytes_per_line = dev->params.pixels_per_line; in sane_get_parameters()
1983 dev->params.format = SANE_FRAME_GRAY; in sane_get_parameters()
1985 dev->params.depth = 8; in sane_get_parameters()
1989 memcpy (params, &(dev->params), sizeof (dev->params)); in sane_get_parameters()
1997 Umax_PP_Device *dev = handle; in sane_start() local
2002 if (dev->state == UMAX_PP_STATE_SCANNING) in sane_start()
2011 if (dev->state == UMAX_PP_STATE_CANCELLED) in sane_start()
2033 dev->state = UMAX_PP_STATE_IDLE; in sane_start()
2041 dev->val[OPT_LAMP_CONTROL].w = SANE_TRUE; in sane_start()
2044 if (dev->val[OPT_MANUAL_GAIN].w == SANE_TRUE) in sane_start()
2051 if (dev->color == UMAX_PP_MODE_COLOR) in sane_start()
2053 delta = umax_pp_get_sync (dev->dpi); in sane_start()
2059 dev->TopX, in sane_start()
2060 dev->TopY - points, in sane_start()
2061 dev->BottomX - dev->TopX, in sane_start()
2062 dev->BottomY - dev->TopY + points, in sane_start()
2063 dev->dpi, in sane_start()
2064 (dev->red_gain << 8) + (dev->green_gain << 4) + in sane_start()
2065 dev->blue_gain, in sane_start()
2066 (dev->red_offset << 8) + (dev->green_offset << 4) + in sane_start()
2067 dev->blue_offset); in sane_start()
2069 rc = sanei_umax_pp_start (dev->TopX, in sane_start()
2070 dev->TopY - points, in sane_start()
2071 dev->BottomX - dev->TopX, in sane_start()
2072 dev->BottomY - dev->TopY + points, in sane_start()
2073 dev->dpi, in sane_start()
2076 (dev->red_gain << 8) | in sane_start()
2077 (dev->green_gain << 4) | in sane_start()
2078 dev->blue_gain, in sane_start()
2079 (dev->red_offset << 8) | in sane_start()
2080 (dev->green_offset << 4) | in sane_start()
2081 dev->blue_offset, &(dev->bpp), &(dev->tw), in sane_start()
2082 &(dev->th)); in sane_start()
2087 dev->th -= points; in sane_start()
2088 DBG (64, "sane_start: bpp=%d,tw=%d,th=%d\n", dev->bpp, dev->tw, in sane_start()
2089 dev->th); in sane_start()
2094 dev->TopX, in sane_start()
2095 dev->TopY, in sane_start()
2096 dev->BottomX - dev->TopX, in sane_start()
2097 dev->BottomY - dev->TopY, dev->dpi, dev->gray_gain << 4, in sane_start()
2098 dev->gray_offset << 4); in sane_start()
2099 rc = sanei_umax_pp_start (dev->TopX, in sane_start()
2100 dev->TopY, in sane_start()
2101 dev->BottomX - dev->TopX, in sane_start()
2102 dev->BottomY - dev->TopY, in sane_start()
2103 dev->dpi, in sane_start()
2106 dev->gray_gain << 4, in sane_start()
2107 dev->gray_offset << 4, &(dev->bpp), in sane_start()
2108 &(dev->tw), &(dev->th)); in sane_start()
2109 DBG (64, "sane_start: bpp=%d,tw=%d,th=%d\n", dev->bpp, dev->tw, in sane_start()
2110 dev->th); in sane_start()
2120 dev->state = UMAX_PP_STATE_SCANNING; in sane_start()
2121 dev->buflen = 0; in sane_start()
2122 dev->bufread = 0; in sane_start()
2123 dev->read = 0; in sane_start()
2128 && (dev->color == UMAX_PP_MODE_COLOR)) in sane_start()
2131 sanei_umax_pp_read (2 * delta * dev->tw * dev->bpp, dev->tw, dev->dpi, in sane_start()
2133 dev->buf + UMAX_PP_RESERVE - in sane_start()
2134 2 * delta * dev->tw * dev->bpp); in sane_start()
2144 if ((dev->color == UMAX_PP_MODE_COLOR) && (delta > 0)) in sane_start()
2147 sanei_umax_pp_read (2 * delta * dev->tw * dev->bpp, dev->tw, dev->dpi, in sane_start()
2149 dev->buf + UMAX_PP_RESERVE - in sane_start()
2150 2 * delta * dev->tw * dev->bpp); in sane_start()
2167 Umax_PP_Device *dev = handle; in sane_read() local
2180 ll = dev->tw * dev->bpp; in sane_read()
2183 if (dev->state == UMAX_PP_STATE_CANCELLED) in sane_read()
2192 if (dev->read >= dev->th * ll) in sane_read()
2199 if ((dev->buflen == 0) || (dev->bufread >= dev->buflen)) in sane_read()
2203 length = ll * dev->th - dev->read; in sane_read()
2206 if (length <= dev->bufsize) in sane_read()
2214 length = (dev->bufsize / ll) * ll; in sane_read()
2218 if (dev->color == UMAX_PP_MODE_COLOR) in sane_read()
2220 delta = umax_pp_get_sync (dev->dpi); in sane_read()
2222 sanei_umax_pp_read (length, dev->tw, dev->dpi, last, in sane_read()
2223 dev->buf + UMAX_PP_RESERVE); in sane_read()
2226 rc = sanei_umax_pp_read (length, dev->tw, dev->dpi, last, dev->buf); in sane_read()
2229 dev->buflen = length; in sane_read()
2233 if (dev->color == UMAX_PP_MODE_LINEART) in sane_read()
2239 if (dev->buf[y] > max) in sane_read()
2240 max = dev->buf[y]; in sane_read()
2241 if (dev->buf[y] < min) in sane_read()
2242 min = dev->buf[y]; in sane_read()
2247 if (dev->buf[y] > max) in sane_read()
2248 dev->buf[y] = 255; in sane_read()
2250 dev->buf[y] = 0; in sane_read()
2253 else if (dev->color == UMAX_PP_MODE_COLOR) in sane_read()
2256 nl = dev->buflen / ll; in sane_read()
2259 lbuf = (SANE_Byte *) malloc (dev->bufsize + UMAX_PP_RESERVE); in sane_read()
2263 dev->bufsize + UMAX_PP_RESERVE); in sane_read()
2269 for (x = 0; x < dev->tw; x++) in sane_read()
2275 lbuf[x * dev->bpp + y * ll + 1 + UMAX_PP_RESERVE] = in sane_read()
2276 dev->buf[x + y * ll + 2 * dev->tw + UMAX_PP_RESERVE]; in sane_read()
2279 lbuf[x * dev->bpp + y * ll + 2 + UMAX_PP_RESERVE] = in sane_read()
2280 dev->buf[x + (y - delta) * ll + dev->tw + in sane_read()
2284 lbuf[x * dev->bpp + y * ll + UMAX_PP_RESERVE] = in sane_read()
2285 dev->buf[x + (y - 2 * delta) * ll + UMAX_PP_RESERVE]; in sane_read()
2290 lbuf[x * dev->bpp + y * ll + UMAX_PP_RESERVE] = in sane_read()
2291 dev->buf[x + y * ll + 2 * dev->tw + UMAX_PP_RESERVE]; in sane_read()
2294 lbuf[x * dev->bpp + y * ll + 1 + UMAX_PP_RESERVE] = in sane_read()
2295 dev->buf[x + (y - delta) * ll + dev->tw + in sane_read()
2299 lbuf[x * dev->bpp + y * ll + 2 + UMAX_PP_RESERVE] = in sane_read()
2300 dev->buf[x + (y - 2 * delta) * ll + UMAX_PP_RESERVE]; in sane_read()
2307 dev->buf + UMAX_PP_RESERVE + dev->buflen - 2 * delta * ll, in sane_read()
2309 free (dev->buf); in sane_read()
2310 dev->buf = lbuf; in sane_read()
2312 dev->bufread = 0; in sane_read()
2316 length = dev->buflen - dev->bufread; in sane_read()
2323 if (dev->color == UMAX_PP_MODE_COLOR) in sane_read()
2324 memcpy (buf, dev->buf + dev->bufread + UMAX_PP_RESERVE, length); in sane_read()
2326 memcpy (buf, dev->buf + dev->bufread, length); in sane_read()
2328 dev->bufread += length; in sane_read()
2329 dev->read += length; in sane_read()
2339 Umax_PP_Device *dev = handle; in sane_cancel() local
2343 if (dev->state == UMAX_PP_STATE_IDLE) in sane_cancel()
2348 if (dev->state == UMAX_PP_STATE_SCANNING) in sane_cancel()
2352 dev->buflen = 0; in sane_cancel()
2354 dev->state = UMAX_PP_STATE_CANCELLED; in sane_cancel()
2370 dev->state = UMAX_PP_STATE_IDLE; in sane_cancel()