Lines Matching defs:chndl
267 cp2155_set_gamma (int fd, CANON_Handle * chndl)
272 makegammatable (chndl->table_gamma, chndl->highlight_other, buf);
279 cp2155_set_gamma_red_enhanced (int fd, CANON_Handle * chndl)
284 makegammatable (chndl->table_gamma, chndl->highlight_red_enhanced, buf);
286 makegammatable (chndl->table_gamma, chndl->highlight_other, buf);
288 makegammatable (chndl->table_gamma_blue, chndl->highlight_blue_reduced,
550 startblob_2225_0075 (CANON_Handle * chndl, unsigned char *buf)
554 fd = chndl->fd;
571 cp2155_set (fd, 0x08, chndl->value_08);
572 cp2155_set (fd, 0x09, chndl->value_09);
573 cp2155_set (fd, 0x0a, chndl->value_0a);
574 cp2155_set (fd, 0x0b, chndl->value_0b);
586 cp2155_set (fd, 0x51, chndl->value_51);
607 cp2155_set (fd, 0x51, chndl->value_51);
641 cp2155_set (fd, 0x67, chndl->value_67);
642 cp2155_set (fd, 0x68, chndl->value_68);
665 startblob_2225_0150 (CANON_Handle * chndl, unsigned char *buf)
669 fd = chndl->fd;
685 cp2155_set (fd, 0x08, chndl->value_08);
686 cp2155_set (fd, 0x09, chndl->value_09);
687 cp2155_set (fd, 0x0a, chndl->value_0a);
688 cp2155_set (fd, 0x0b, chndl->value_0b);
700 cp2155_set (fd, 0x51, chndl->value_51);
721 cp2155_set (fd, 0x51, chndl->value_51);
755 cp2155_set (fd, 0x67, chndl->value_67);
756 cp2155_set (fd, 0x68, chndl->value_68);
779 startblob_2225_0300 (CANON_Handle * chndl, unsigned char *buf)
783 fd = chndl->fd;
799 cp2155_set (fd, 0x08, chndl->value_08);
800 cp2155_set (fd, 0x09, chndl->value_09);
801 cp2155_set (fd, 0x0a, chndl->value_0a);
802 cp2155_set (fd, 0x0b, chndl->value_0b);
814 cp2155_set (fd, 0x51, chndl->value_51);
835 cp2155_set (fd, 0x51, chndl->value_51);
869 cp2155_set (fd, 0x67, chndl->value_67);
870 cp2155_set (fd, 0x68, chndl->value_68);
892 startblob_2225_0600 (CANON_Handle * chndl, unsigned char *buf)
896 fd = chndl->fd;
912 cp2155_set (fd, 0x08, chndl->value_08);
913 cp2155_set (fd, 0x09, chndl->value_09);
914 cp2155_set (fd, 0x0a, chndl->value_0a);
915 cp2155_set (fd, 0x0b, chndl->value_0b);
927 cp2155_set (fd, 0x51, chndl->value_51);
948 cp2155_set (fd, 0x51, chndl->value_51);
979 cp2155_set (fd, 0x67, chndl->value_67);
980 cp2155_set (fd, 0x68, chndl->value_68);
1002 startblob_2225_1200 (CANON_Handle * chndl, unsigned char *buf)
1006 fd = chndl->fd;
1021 cp2155_set (fd, 0x08, chndl->value_08);
1022 cp2155_set (fd, 0x09, chndl->value_09);
1023 cp2155_set (fd, 0x0a, chndl->value_0a);
1024 cp2155_set (fd, 0x0b, chndl->value_0b);
1036 cp2155_set (fd, 0x51, chndl->value_51);
1057 cp2155_set (fd, 0x51, chndl->value_51);
1091 cp2155_set (fd, 0x67, chndl->value_67);
1092 cp2155_set (fd, 0x68, chndl->value_68);
1111 startblob_2224_0075 (CANON_Handle * chndl, unsigned char *buf)
1115 fd = chndl->fd;
1133 cp2155_set (fd, 0x08, chndl->value_08);
1134 cp2155_set (fd, 0x09, chndl->value_09);
1135 cp2155_set (fd, 0x0a, chndl->value_0a);
1136 cp2155_set (fd, 0x0b, chndl->value_0b);
1149 cp2155_set (fd, 0x51, chndl->value_51);
1170 cp2155_set (fd, 0x51, chndl->value_51);
1204 cp2155_set (fd, 0x67, chndl->value_67);
1205 cp2155_set (fd, 0x68, chndl->value_68);
1228 startblob_2224_0150 (CANON_Handle * chndl, unsigned char *buf)
1232 fd = chndl->fd;
1250 cp2155_set (fd, 0x08, chndl->value_08);
1251 cp2155_set (fd, 0x09, chndl->value_09);
1252 cp2155_set (fd, 0x0a, chndl->value_0a);
1253 cp2155_set (fd, 0x0b, chndl->value_0b);
1266 cp2155_set (fd, 0x51, chndl->value_51);
1287 cp2155_set (fd, 0x51, chndl->value_51);
1321 cp2155_set (fd, 0x67, chndl->value_67);
1322 cp2155_set (fd, 0x68, chndl->value_68);
1345 startblob_2224_0300 (CANON_Handle * chndl, unsigned char *buf)
1348 fd = chndl->fd;
1366 cp2155_set (fd, 0x08, chndl->value_08);
1367 cp2155_set (fd, 0x09, chndl->value_09);
1368 cp2155_set (fd, 0x0a, chndl->value_0a);
1369 cp2155_set (fd, 0x0b, chndl->value_0b);
1382 cp2155_set (fd, 0x51, chndl->value_51);
1403 cp2155_set (fd, 0x51, chndl->value_51);
1434 cp2155_set (fd, 0x67, chndl->value_67);
1435 cp2155_set (fd, 0x68, chndl->value_68);
1458 startblob_2224_0600 (CANON_Handle * chndl, unsigned char *buf)
1462 fd = chndl->fd;
1480 cp2155_set (fd, 0x08, chndl->value_08);
1481 cp2155_set (fd, 0x09, chndl->value_09);
1482 cp2155_set (fd, 0x0a, chndl->value_0a);
1483 cp2155_set (fd, 0x0b, chndl->value_0b);
1496 cp2155_set (fd, 0x51, chndl->value_51);
1517 cp2155_set (fd, 0x51, chndl->value_51);
1551 cp2155_set (fd, 0x67, chndl->value_67);
1552 cp2155_set (fd, 0x68, chndl->value_68);
1571 startblob_2224_1200 (CANON_Handle * chndl, unsigned char *buf)
1574 chndl->value_51 = 0x0f;
1577 fd = chndl->fd;
1606 cp2155_set (fd, 0x08, chndl->value_08);
1607 cp2155_set (fd, 0x09, chndl->value_09);
1608 cp2155_set (fd, 0x0a, chndl->value_0a);
1609 cp2155_set (fd, 0x0b, chndl->value_0b);
1622 cp2155_set (fd, 0x51, chndl->value_51);
1643 cp2155_set (fd, 0x51, chndl->value_51);
1678 cp2155_set (fd, 0x67, chndl->value_67);
1679 cp2155_set (fd, 0x68, chndl->value_68);
1703 startblob_2224_2400 (CANON_Handle * chndl, unsigned char *buf)
1707 fd = chndl->fd;
1744 cp2155_set (fd, 0x08, chndl->value_08);
1745 cp2155_set (fd, 0x09, chndl->value_09);
1746 cp2155_set (fd, 0x0a, chndl->value_0a);
1747 cp2155_set (fd, 0x0b, chndl->value_0b);
1760 cp2155_set (fd, 0x51, chndl->value_51);
1781 cp2155_set (fd, 0x51, chndl->value_51);
1815 cp2155_set (fd, 0x66, chndl->value_66);
1816 cp2155_set (fd, 0x67, chndl->value_67);
1817 cp2155_set (fd, 0x68, chndl->value_68);
1841 startblob_2224_4800 (CANON_Handle * chndl, unsigned char *buf)
1845 fd = chndl->fd;
1882 cp2155_set (fd, 0x08, chndl->value_08);
1883 cp2155_set (fd, 0x09, chndl->value_09);
1884 cp2155_set (fd, 0x0a, chndl->value_0a);
1885 cp2155_set (fd, 0x0b, chndl->value_0b);
1898 cp2155_set (fd, 0x51, chndl->value_51);
1919 cp2155_set (fd, 0x51, chndl->value_51);
1953 cp2155_set (fd, 0x66, chndl->value_66);
1954 cp2155_set (fd, 0x67, chndl->value_67);
1955 cp2155_set (fd, 0x68, chndl->value_68);
1979 startblob_2224_4799 (CANON_Handle * chndl, unsigned char *buf)
1983 fd = chndl->fd;
2021 cp2155_set (fd, 0x08, chndl->value_08);
2022 cp2155_set (fd, 0x09, chndl->value_09);
2023 cp2155_set (fd, 0x0a, chndl->value_0a);
2024 cp2155_set (fd, 0x0b, chndl->value_0b);
2037 cp2155_set (fd, 0x51, chndl->value_51);
2058 cp2155_set (fd, 0x51, chndl->value_51);
2092 cp2155_set (fd, 0x66, chndl->value_66);
2093 cp2155_set (fd, 0x67, chndl->value_67);
2094 cp2155_set (fd, 0x68, chndl->value_68);
2117 send_start_blob (CANON_Handle * chndl)
2122 fd = chndl->fd;
2129 chndl->value_51 = 0x07;
2130 chndl->value_66 = 0x00;
2132 switch (chndl->val[opt_resolution].w)
2135 chndl->value_67 = 0x0a; /* 3*7300/8 */
2136 chndl->value_68 = 0xb1;
2139 chndl->value_67 = 0x15; /* 3*7300/4 */
2140 chndl->value_68 = 0x63;
2143 chndl->value_67 = 0x2a; /* 3*7300/2 */
2144 chndl->value_68 = 0xc6;
2147 chndl->value_67 = 0x55; /* 3*7300 */
2148 chndl->value_68 = 0x8c;
2151 chndl->value_67 = 0xab; /* 6*7300 */
2152 chndl->value_68 = 0x18;
2155 chndl->value_66 = 0x01;
2156 chndl->value_67 = 0x56; /* 12*7300 */
2157 chndl->value_68 = 0x30;
2160 chndl->value_66 = 0x02;
2161 chndl->value_67 = 0xac; /* 24*7300 */
2162 chndl->value_68 = 0x60;
2179 cp2155_set_gamma (fd, chndl);
2181 switch (chndl->val[opt_resolution].w)
2184 if (chndl->productcode == 0x2225)
2186 startblob_2225_0075 (chndl, buf);
2190 startblob_2224_0075 (chndl, buf);
2194 if (chndl->productcode == 0x2225)
2196 startblob_2225_0150 (chndl, buf);
2200 startblob_2224_0150 (chndl, buf);
2204 if (chndl->productcode == 0x2225)
2206 startblob_2225_0300 (chndl, buf);
2210 cp2155_set_gamma_red_enhanced (fd, chndl);
2211 startblob_2224_0300 (chndl, buf);
2215 if (chndl->productcode == 0x2225)
2217 cp2155_set_gamma_red_enhanced (fd, chndl);
2218 startblob_2225_0600 (chndl, buf);
2220 startblob_2225_0600_extra (chndl, buf);
2225 startblob_2224_0600 (chndl, buf);
2229 if (chndl->productcode == 0x2225)
2231 startblob_2225_1200 (chndl, buf);
2235 startblob_2224_1200 (chndl, buf);
2239 if (chndl->productcode == 0x2225)
2241 startblob_2225_1200 (chndl, buf);
2245 startblob_2224_2400 (chndl, buf);
2249 if (chndl->productcode == 0x2225)
2251 startblob_2225_1200 (chndl, buf);
2255 startblob_2224_4800 (chndl, buf);
2263 wait_for_data (CANON_Handle * chndl)
2266 fd = chndl->fd;
2280 send_start_blob (chndl);
2325 init_2225 (CANON_Handle * chndl)
2327 int fd = chndl->fd;
2392 init_2224 (CANON_Handle * chndl)
2394 int fd = chndl->fd;
2446 init (CANON_Handle * chndl)
2449 if (chndl->productcode == 0x2225)
2451 chndl->table_gamma = 2.2;
2452 chndl->table_gamma_blue = 2.2;
2453 chndl->highlight_red_enhanced = 190;
2454 chndl->highlight_other = 240;
2455 chndl->highlight_blue_reduced = 240;
2456 result = init_2225 (chndl);
2460 chndl->table_gamma = 2.2;
2461 chndl->table_gamma_blue = 1.95;
2462 chndl->highlight_red_enhanced = 190;
2463 chndl->highlight_other = 215;
2464 chndl->highlight_blue_reduced = 255;
2465 result = init_2224 (chndl);
2698 go_home_without_wait (CANON_Handle * chndl)
2701 int fd = chndl->fd;
2709 DBG (1, "go_home_without_wait: product code: %x\n", chndl->productcode);
2710 if (chndl->productcode == 0x2225)
2722 go_home (CANON_Handle * chndl)
2724 int fd = chndl->fd;
2733 go_home_without_wait (chndl);
2751 preread (CANON_Handle * chndl, SANE_Byte * data, FILE * fp)
2757 int fd = chndl->fd;
2758 long width = chndl->params.pixels_per_line;
2781 if (line >= (chndl->y1) * chndl->val[opt_resolution].w / 600
2782 + chndl->params.lines)
2785 init (chndl);
2791 datasize = wait_for_data (chndl);
2841 if (line > (chndl->y1) * chndl->val[opt_resolution].w / 600)
2843 if (chndl->params.format == SANE_FRAME_RGB)
2845 memcpy (data + offset, linebuf, 3 * chndl->width);
2846 offset += 3 * chndl->width;
2852 while (lineelement < chndl->width)
2858 if (chndl->params.depth == 8) /* gray */
2869 chndl->absolute_threshold)
2877 offset += chndl->params.bytes_per_line;
2882 if (line == (chndl->y1) * chndl->val[opt_resolution].w / 600
2883 + chndl->params.lines)
2904 do_scan (CANON_Handle * chndl)
2909 fp = fopen (chndl->fname, "w");
2912 DBG (1, "err:%s when opening %s\n", strerror (errno), chndl->fname);
2915 long width = chndl->params.pixels_per_line;
2916 if (chndl->val[opt_resolution].w < 600)
2918 width = width * 600 / chndl->val[opt_resolution].w;
2929 switch (chndl->val[opt_resolution].w)
2935 if (chndl->productcode == 0x2224)
2945 if (chndl->productcode == 0x2224)
2955 if (chndl->productcode == 0x2224)
2965 if (chndl->productcode == 0x2224)
2974 x_start = left_edge + chndl->x1 * chndl->val[opt_resolution].w / 600;
2975 if (chndl->val[opt_resolution].w < 600)
2977 x_start = left_edge + chndl->x1;
2982 chndl->value_08 = (x_start >> 8) & 0xff;
2983 chndl->value_09 = (x_start) & 0xff;
2984 chndl->value_0a = (x_end >> 8) & 0xff;
2985 chndl->value_0b = (x_end) & 0xff;
2987 DBG (3, "val_08: %02x\n", chndl->value_08);
2988 DBG (3, "val_09: %02x\n", chndl->value_09);
2989 DBG (3, "val_0a: %02x\n", chndl->value_0a);
2990 DBG (3, "val_0b: %02x\n", chndl->value_0b);
2991 DBG (3, "chndl->width: %04lx\n", chndl->width);
2993 send_start_blob (chndl);
2997 status = preread (chndl, outbuf, fp);
2999 go_home_without_wait (chndl);
3007 DBG (6, "created scan file %s\n", chndl->fname);
3017 scan (CANON_Handle * chndl)
3021 switch (chndl->val[opt_resolution].w)
3032 chndl->val[opt_resolution].w = 600;
3035 chndl->width = chndl->params.pixels_per_line;
3036 chndl->height =
3037 (chndl->y2 - chndl->y1) * chndl->val[opt_resolution].w / 600;
3038 DBG (1, "dpi=%d\n", chndl->val[opt_resolution].w);
3039 DBG (1, "x1=%d y1=%d\n", chndl->x1, chndl->y1);
3040 DBG (1, "x2=%d y2=%d\n", chndl->x2, chndl->y2);
3041 DBG (1, "width=%ld height=%ld\n", chndl->width, chndl->height);
3043 CHK (do_scan (chndl));
3049 CANON_set_scan_parameters (CANON_Handle * chndl)
3067 if (chndl->val[opt_resolution].w < 300)
3071 if (chndl->val[opt_resolution].w == 300 && chndl->productcode == 0x2224)
3076 left = SANE_UNFIX (chndl->val[opt_tl_x].w) / MM_IN_INCH * 600;
3077 top = (top_edge + SANE_UNFIX (chndl->val[opt_tl_y].w)) / MM_IN_INCH * 600;
3078 right = SANE_UNFIX (chndl->val[opt_br_x].w) / MM_IN_INCH * 600;
3080 (top_edge + SANE_UNFIX (chndl->val[opt_br_y].w)) / MM_IN_INCH * 600;
3082 leftf = SANE_UNFIX (chndl->val[opt_tl_x].w);
3083 rightf = SANE_UNFIX (chndl->val[opt_br_x].w);
3084 topf = SANE_UNFIX (chndl->val[opt_tl_y].w);
3085 bottomf = SANE_UNFIX (chndl->val[opt_br_y].w);
3115 if ((chndl->val[opt_resolution].w != 75) &&
3116 (chndl->val[opt_resolution].w != 150) &&
3117 (chndl->val[opt_resolution].w != 300) &&
3118 (chndl->val[opt_resolution].w != 600) &&
3119 (chndl->val[opt_resolution].w != 1200) &&
3120 (chndl->val[opt_resolution].w != 2400) &&
3121 (chndl->val[opt_resolution].w != 4800))
3127 chndl->x1 = left;
3128 chndl->x2 = left + widthi;
3129 chndl->y1 = top;
3130 chndl->y2 = top + heighti;
3131 chndl->absolute_threshold = (chndl->val[opt_threshold].w * 255) / 100;
3209 CANON_get_device_name (CANON_Handle * chndl)
3211 return chndl->product;
3216 CANON_finish_scan (CANON_Handle * chndl)
3220 if (chndl->fp)
3222 fclose (chndl->fp);
3225 chndl->fp = NULL;
3228 if (chndl->fname)
3230 DBG (4, "removing temp file %s\n", chndl->fname);
3231 unlink (chndl->fname);
3232 free (chndl->fname);
3235 chndl->fname = NULL;
3241 CANON_start_scan (CANON_Handle * chndl)
3249 chndl->fname = strdup ("/tmp/scan.XXXXXX");
3250 fd = mkstemp (chndl->fname);
3260 result = init (chndl);
3268 go_home (chndl);
3271 if ((status = scan (chndl)) != SANE_STATUS_GOOD)
3273 CANON_finish_scan (chndl);
3278 chndl->fp = fopen (chndl->fname, "r");
3279 DBG (4, "reading %s\n", chndl->fname);
3281 if (!chndl->fp)
3283 DBG (1, "open %s", chndl->fname);
3292 CANON_read (CANON_Handle * chndl, SANE_Byte * data,
3300 if (!chndl->fp)
3305 read_len = fread (data, 1, max_length, chndl->fp);
3317 if (feof (chndl->fp))
3328 CANON_finish_scan (chndl);