Subject: kern/2248: Two bug fixes for SCSI scanner driver
To: None <gnats-bugs@NetBSD.ORG>
From: Kenneth Stailey <kstailey@dol-esa.gov>
List: netbsd-bugs
Date: 03/22/1996 09:41:06
>Number: 2248
>Category: kern
>Synopsis: problem with HP Scanjet image data & attach messages
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 22 09:50:02 1996
>Last-Modified:
>Originator: Kenneth Stailey
>Organization:
DOL/ESA/DASM
>Release: March 14, 1996
>Environment:
System: NetBSD owl 1.1A NetBSD 1.1A (OWL) #0: Wed Mar 20 16:45:51 EST 1996 kstailey@owl:/usr/src/sys/arch/i386/compile/OWL i386
>Description:
Certain combinations of size and resolution yield scrambled image
data from HP Scanjet.
The default brightness and contrast are also too low.
Attach messages also have a blank line where the model name used
to print.
>How-To-Repeat:
use: "set_scanner -r 150 -w 1.25 -h 1 -i g"
Scan something and view image data, it will have a diagonal shear
due to width being off by one pixel.
>Fix:
--- /sys/scsi/ss.c Sat Mar 16 11:33:15 1996
+++ ss.c Mon Mar 18 09:26:27 1996
@@ -149,8 +149,6 @@
ss->buf_queue.b_active = 0;
ss->buf_queue.b_actf = 0;
ss->buf_queue.b_actb = &ss->buf_queue.b_actf;
-
- printf("\n");
}
/*
--- /sys/scsi/ss_mustek.c Sat Mar 16 11:33:15 1996
+++ ss_mustek.c Mon Mar 18 22:57:38 1996
@@ -106,14 +106,16 @@
SC_DEBUG(sc_link, SDEV_DB1, ("mustek_attach: start\n"));
ss->sio.scan_scanner_type = 0;
+ printf("\n%s: ", ss->sc_dev.dv_xname);
+
/* first, check the model which determines resolutions */
if (!bcmp(sa->sa_inqbuf->product, "MFS-06000CX", 11)) {
ss->sio.scan_scanner_type = MUSTEK_06000CX;
- printf(": Mustek 6000CX Flatbed 3-pass color scanner, 3 - 600 dpi\n");
+ printf("Mustek 6000CX Flatbed 3-pass color scanner, 3 - 600 dpi\n");
}
if (!bcmp(sa->sa_inqbuf->product, "MFS-12000CX", 11)) {
ss->sio.scan_scanner_type = MUSTEK_12000CX;
- printf(": Mustek 12000CX Flatbed 3-pass color scanner, 6 - 1200 dpi\n");
+ printf("Mustek 12000CX Flatbed 3-pass color scanner, 6 - 1200 dpi\n");
}
SC_DEBUG(sc_link, SDEV_DB1, ("mustek_attach: scanner_type = %d\n",
--- /sys/scsi/ss_scanjet.c Sat Mar 16 11:33:15 1996
+++ ss_scanjet.c Thu Mar 21 08:32:04 1996
@@ -91,18 +91,20 @@
SC_DEBUG(sc_link, SDEV_DB1, ("scanjet_attach: start\n"));
ss->sio.scan_scanner_type = 0;
+ printf("\n%s: ", ss->sc_dev.dv_xname);
+
/* first, check the model (which determines nothing yet) */
if (!bcmp(sa->sa_inqbuf->product, "C1750A", 6)) {
ss->sio.scan_scanner_type = HP_SCANJET_IIC;
- printf(": HP ScanJet IIc\n");
+ printf("HP ScanJet IIc\n");
}
if (!bcmp(sa->sa_inqbuf->product, "C2500A", 6)) {
ss->sio.scan_scanner_type = HP_SCANJET_IIC;
- printf(": HP ScanJet IIcx\n");
+ printf("HP ScanJet IIcx\n");
}
- SC_DEBUG(sc_link, SDEV_DB1, ("mustek_attach: scanner_type = %d\n",
+ SC_DEBUG(sc_link, SDEV_DB1, ("scanjet_attach: scanner_type = %d\n",
ss->sio.scan_scanner_type));
/* now install special handlers */
@@ -117,8 +119,8 @@
ss->sio.scan_y_resolution = 100;
ss->sio.scan_x_origin = 0;
ss->sio.scan_y_origin = 0;
- ss->sio.scan_brightness = 100;
- ss->sio.scan_contrast = 100;
+ ss->sio.scan_brightness = 128;
+ ss->sio.scan_contrast = 128;
ss->sio.scan_quality = 100;
ss->sio.scan_image_mode = SIM_GRAYSCALE;
@@ -374,6 +376,7 @@
scanjet_compute_sizes(ss)
struct ss_softc *ss;
{
+ int r = 0; /* round up by r 1/1200" */
/*
* Deal with the fact that the HP ScanJet IIc uses 1/300" not 1/1200"
@@ -389,22 +392,24 @@
ss->sio.scan_bits_per_pixel = 1;
break;
case SIM_GRAYSCALE:
+ r = 600;
ss->sio.scan_bits_per_pixel = 8;
break;
case SIM_COLOR:
+ r = 600;
ss->sio.scan_bits_per_pixel = 24;
break;
}
ss->sio.scan_pixels_per_line =
- (ss->sio.scan_width * ss->sio.scan_x_resolution) / 1200;
+ (ss->sio.scan_width * ss->sio.scan_x_resolution + r) / 1200;
if (ss->sio.scan_bits_per_pixel == 1)
/* pad to byte boundary: */
ss->sio.scan_pixels_per_line =
(ss->sio.scan_pixels_per_line + 7) & 0xfffffff8;
ss->sio.scan_lines =
- (ss->sio.scan_height * ss->sio.scan_y_resolution) / 1200;
+ (ss->sio.scan_height * ss->sio.scan_y_resolution + r) / 1200;
ss->sio.scan_window_size = ss->sio.scan_lines *
((ss->sio.scan_pixels_per_line * ss->sio.scan_bits_per_pixel) / 8);
}
>Audit-Trail:
>Unformatted: