Menu ▾ ▴

#765 Canon: density adjustments use subchannel count instead of index

5.3-fixed
closed-accepted
nobody
5
2 days ago
2 days ago
No

Affected source

src/main/print-canon.c, canon_setup_channels().
Confirmed in Debian Gutenprint 5.3.4.20220624T01008808d602-4 and official
master 76b0f3571a1cf3d07fe9068e87840be94d28df5a.
Observed hardware: Canon iP4600, bjc-iP4600-series, Debian 13 ARM64.

Cause

Inside for(i=0;i<subchannel;i++), the code calls:

stp_channel_set_density_adjustment(v,channel,subchannel,density);

Here subchannel is the number of configured subchannels, not their index.
channel.c:get_channel() rejects an index greater than or equal to that
count and returns NULL. Consequently, the intended density adjustment is
silently ignored and the initialized density remains 65535 (1.0).

Minimal fix

Use the loop index i as the third argument. The attached patch changes
only that argument. It does not alter channel selection, paper handling,
model parameters or USB communication.

Evidence

An earlier offline comparison using the real Debian filter and identical
A4 input raster, plain paper, standard color mode, showed:

Quantity Original Corrected
Requested C/M/Y density 0.468 0.468
Effective C/M/Y density 65535 (1.0) 30670 (about 0.468)
Requested black density 0.0 0.0
Effective black density 65535 (1.0) 0
Set K bits in decoded output 1231271 0

Bit counts demonstrate channel use; they are not measured ink consumption.
The corrected driver also removed user-observed black stripes from the
printed color test areas. That observation does not establish universal
color accuracy or repair the separate USB transport issue.

Regression tests

test_density_subchannel.py extracts and compiles the actual upstream loop
with a stub that preserves channel.c's out-of-range behavior. Cases cover
zero black density, scaled color density, unit density, two and three
subchannels, secondary density and multiplication by global density.
All six fail against the reviewed unmodified master and pass with the patch.
Requires Python 3 and a C99 compiler; no printer or Gutenprint installation.

CANON_SOURCE="$PWD/src/main/print-canon.c" python3 /path/to/test_density_subchannel.py -v

The shared Canon code suggests other models may be affected; hardware
verification was limited to the iP4600. Please review interactions with
existing Canon density calibration when merging this correction.

Ticket #701 reported that
density controls had no visible effect on a Canon MG5250. It was closed as
out-of-date in 2024, without identifying this indexing error. The shared
code makes a connection plausible, but the MG5250 has not been tested here.
This report supplies a current-master reproduction and focused correction;
it does not establish that every symptom in #701 has the same cause.

Attachments: 01-canon-density-subchannel.patch, test_density_subchannel.py.

2 Attachments

Discussion

  • Solomon Peachy

    Solomon Peachy - 2 days ago
    • Description has changed:

    Diff:

    
    
    • status: open --> closed-accepted
    • Group: --> 5.3-fixed
    • Priority: --> 5
     
  • Solomon Peachy

    Solomon Peachy - 2 days ago

    Thank you for the fix.

    FYI, a multi-page report for a one-line code change is ridiculous.

     

Log in to post a comment.