Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed scan with Brother DCP-1622W #92

Open
leshniak opened this issue Oct 8, 2022 · 23 comments
Open

Failed scan with Brother DCP-1622W #92

leshniak opened this issue Oct 8, 2022 · 23 comments

Comments

@leshniak
Copy link

leshniak commented Oct 8, 2022

I have troubles while scanning documents with Brother DCP-1622W via airsane v0.3.4 and macOS 12.5. The preview looks good, but target scans are always weirdly trimmed and corrupted. It doesn't matter if I change the scan format/area. Scanning using scanimage works fine.

This might be helpful:

git commit: N/A (branch N/A, rev N/A+)
build date: 2022-10-07T15:57:18Z
reading device options from '/etc/airsane/options.conf'
enumerating  devices...
sane_init(nullptr, nullptr)
sane_get_devices() ...
... sane_get_devices() -> SANE_Status Success
sane_exit()
found: Brother_DCP-1610W_series@edison (Brother *DCP-1610W)
stable unique name: Brother_DCP-1610W_series@edison:Brother *DCP-1610W:1
uuid: 842a8d0a-d7b2-5c56-9a3b-d76e4b40fd35
sane_init(nullptr, nullptr)
sane_open(Brother_DCP-1610W_series@edison) -> 0x7f900092b0
[source] := "FlatBed"
[source] := "Automatic Document Feeder(left aligned,Duplex)"
sane_close(0x7f900092b0)
sane_exit()
published as 'Brother *DCP-1610W'
listening on 192.168.5.2:8091
listening on [fe80::dea6:32ff:fe03:3c61]:8091
document format requested: image/jpeg
document format used: image/png
job kind: single
using color gamma of 1
sane_init(nullptr, nullptr)
sane_open(Brother_DCP-1610W_series@edison) -> 0x7f88008100
[mode] := "24bit Color" -> reload options
[source] := "FlatBed"
[resolution] := 100dpi
[tl-x] := 0mm
[tl-y] := 0mm
[br-x] := 212mm
[br-y] := 356mm
sane_start(0x7f88008100) with options:
[br-x] = 211.881mm
[br-y] = 355.567mm
[mode] = "24bit Color"
[resolution] = 100dpi
[source] = "FlatBed"
[tl-x] = 0mm
[tl-y] = 0mm
sane_read(0x7f88008100): End of file reached
images completed: 1
sane_cancel(0x7f88008100)
sane_cancel(0x7f88008100)
sane_close(0x7f88008100)
sane_exit()
document format requested: image/jpeg
document format used: image/png
job kind: single
using color gamma of 1
sane_init(nullptr, nullptr)
sane_open(Brother_DCP-1610W_series@edison) -> 0x7f88008f00
[mode] := "24bit Color" -> reload options
[source] := "FlatBed"
[resolution] := 300dpi
[tl-x] := 0mm
[tl-y] := 65mm
[br-x] := 207mm
[br-y] := 356mm
sane_start(0x7f88008f00) with options:
[br-x] = 206.981mm
[br-y] = 355.567mm
[mode] = "24bit Color"
[resolution] = 300dpi
[source] = "FlatBed"
[tl-x] = 0mm
[tl-y] = 64.994mm
sane_read(0x7f88008f00): End of file reached
images completed: 1
incomplete or excess scan data
sane_cancel(0x7f88008f00)
sane_cancel(0x7f88008f00)
sane_close(0x7f88008f00)
sane_exit()

Zrzut ekranu 2022-10-8 o 09 15 36

P.S. Thanks for your job!

@SimulPiscator
Copy link
Owner

In v3.4.0, there was a bug, ignoring that SANE parameter settings might interfere with each other, i.e. setting one parameter could result in changes to other parameters.
Since v3.5.0, SANE parameters are set in an order that makes it unlikely to result in unwanted parameter changes.

There is a chance that the problem might go away when you switch to v3.5.0.

@leshniak
Copy link
Author

leshniak commented Oct 8, 2022

Ok, I'll try it after the weekend and go back with the result.

@meiser79
Copy link

Seems to be the same issue as described in #40.

@leshniak
Copy link
Author

Unfortunately the issue still exists :/

git commit: fef10a4 (branch HEAD, rev 245)
build date: 2022-10-09T10:51:14Z

How I can help with debugging?

@SimulPiscator
Copy link
Owner

Thanks for your offer to help with debugging. Could you post one of the distorted scans? Also, please give me some time to go back to @meiser79 's issue #40, and to contemplate my source code.

@leshniak
Copy link
Author

leshniak commented Oct 11, 2022

Outputs:
scanimage.log.txt
scanimage
airsaned

@SimulPiscator
Copy link
Owner

SimulPiscator commented Oct 12, 2022

Apart from being cut at the top, the scanned image looks fine. So the issue is how it happens that tl-y is set to 65mm rather than 0. @meiser79 reported on a very similar (or identical) issue (#40) that the nonzero value is actually sent by Apple Image Capture.

If you have access to a Windows 10 or Windows 11 installation, can you try scanning from there? Just to see whether it's an Apple Image Capture issue, or an AirSane one.

Another option would be to install the sane-airscan backend and use scanimage to scan through sane-airscan and AirSane.

@SimulPiscator
Copy link
Owner

And (really sorry for mentioning it) did you move the dashed rectangle in the preview area up to the top?

@leshniak
Copy link
Author

I don't have a device with Windows, but I'll try to test it somehow.

Sure, I've tried to move the rectangle even beyond the top - it didn't help.

@leshniak
Copy link
Author

leshniak commented Oct 14, 2022

It works correctly while using the same system scan window with native macOS drivers.

@meiser79
Copy link

Hi, I re-did all my tests with current git version.

I tested with Ubuntu 20.04 net and sane-airscan backend, Windows 10, Mopria and Apple Image Capture (AIC) on macOS 12.6.

It's still the same behaviour as described in #40. Only AIC with advanced options sends the YOffset (tl-y), all other scans are fine.
As described in #40, I guess, it's because the SANE brother4 backend shows 211.881x355.567 mm for maxWidth and maxHeight. But it should be 210x297 mm for A4.
My support request to Brother is unanswered since 18/12/2020.

@stevensantos-docs
Copy link

stevensantos-docs commented Oct 15, 2022 via email

@meiser79
Copy link

meiser79 commented Oct 15, 2022

I found https://gitlab.com/sane-project/backends/-/tree/brother_mfp_backend/backend/brother_mfp, but only one scanner is supported (MFC-J4320DW).

EDIT: merge request is here: https://gitlab.com/sane-project/backends/-/merge_requests/751

@SimulPiscator
Copy link
Owner

SimulPiscator commented Oct 15, 2022

@meiser79

As described in #40, I guess, it's because the SANE brother4 backend shows 211.881x355.567 mm for maxWidth and maxHeight. But it should be 210x297 mm for A4.

IIRC, you even tried forcing maxWidth and maxHeight to the correct values in AirSane, but without success?
If this is not the case, it would be easy to add an option to AirSane to set the maximum scan area to a user-defined value.

@meiser79
Copy link

@SimulPiscator I don't know if I did it right the last time, and I've lost the patch. If you provided a patch for this option, I could test it.

@SimulPiscator
Copy link
Owner

@meiser79
In server/scanner.cpp, before line 635, insert this:
mMaxHeight = 3436; mMaxWidth = 2448;
If this doesn't change anything, you might also try
mMaxPhysicalHeight = 3436; mMaxPhysicalWidth = 2448;

@meiser79
Copy link

Hi, both changes don't help.

The preview scan is fine, tl_y = 0:

document format requested: image/jpeg
document format used: image/png
job kind: single
using color gamma of 0.555555
sane_init(nullptr, nullptr)
sane_open(brother4:bus1;dev1) -> 0x7f3118084460
[source] := "FlatBed"
[mode] := "24bit Color" -> reload options
[resolution] := 100dpi
[tl-x] := 0mm
[tl-y] := 0mm
[br-x] := 210mm
[br-y] := 297mm
sane_start(0x7f3118084460) with options:
[br-x] = 209.981mm
[br-y] = 296.973mm
[mode] = "24bit Color"
[resolution] = 100dpi
[source] = "FlatBed"
[tl-x] = 0mm
[tl-y] = 0mm
sane_read(0x7f3118084460): End of file reached
images completed: 1
sane_cancel(0x7f3118084460)
sane_cancel(0x7f3118084460)
sane_close(0x7f3118084460)
sane_exit()

But on the scan itself, tl_y = 5.99945mm:

document format requested: image/jpeg
document format used: image/png
job kind: single
using color gamma of 0.555555
sane_init(nullptr, nullptr)
sane_open(brother4:bus1;dev1) -> 0x7f31180943b0
[source] := "FlatBed"
[mode] := "24bit Color" -> reload options
[resolution] := 100dpi
[tl-x] := 0mm
[tl-y] := 6mm
[br-x] := 207mm
[br-y] := 297mm
sane_start(0x7f31180943b0) with options:
[br-x] = 206.981mm
[br-y] = 296.973mm
[mode] = "24bit Color"
[resolution] = 100dpi
[source] = "FlatBed"
[tl-x] = 0mm
[tl-y] = 5.99945mm
sane_read(0x7f31180943b0): End of file reached
images completed: 1
sane_cancel(0x7f31180943b0)
sane_cancel(0x7f31180943b0)
sane_close(0x7f31180943b0)
sane_exit()

BTW, I had to increase mMaxHeight/mMaxPhysicalHeight and mMaxWidth/mMaxPhysicalWidth to 2508x2480, so that I can select A4 in AIC.

Just to be sure that I did it right, here's the diff:

diff --git a/server/scanner.cpp b/server/scanner.cpp
index 130afc6..16e8500 100644
--- a/server/scanner.cpp
+++ b/server/scanner.cpp
@@ -632,6 +632,8 @@ Scanner::Private::InputSource::init(const sanecpp::option_set& opt)
                        &mMaxPhysicalWidth,
                        &mMaxPhysicalHeight })
     *pValue = ::floor(*pValue * f + 0.5);
+  mMaxHeight = 3508; mMaxWidth = 2480;
+  mMaxPhysicalHeight = 3508; mMaxPhysicalWidth = 2480;
   return nullptr;
 }
 

@SimulPiscator
Copy link
Owner

@meiser79: The diff looks correct. Also thanks for extensive testing with various scanning software on various OSes!

Given that AIC is the only software that shows this behavior, it's an absolute mystery to me. How does the brother4 backend trigger that in AIC, and why does it exist in AIC in the first place?

@meiser79
Copy link

Sorry, but I have no clue how to continue here. :-(

@leshniak
Copy link
Author

Maybe we should wait for that new open-source driver.

@SimulPiscator
Copy link
Owner

The open-source driver now has support for the DCP-1610W:
https://gitlab.com/sane-project/backends/-/blob/brother_mfp_backend/backend/brother_mfp/brother_mfp.cpp
The DCP-1622W is actually a variant of the DCP-1610W:
https://support.brother.com/g/b/spec.aspx?c=eu_ot&lang=en&prod=dcp1622we_eu

@leshniak
Copy link
Author

I've made it working completely wireless using airscan backend and the following definition in /etc/sane.d/airscan.conf:

[devices]
#"Kyocera MFP Scanner" = http://192.168.1.102:9095/eSCL
#"Some Unwanted Scanner" = disable
"Brother DCP-1610W series" = http://DCP-1610W/WebServices/Device, wsd

It uses WSD protocol supported by this device and then airsaned announces the scanner via AirScan.

@SimulPiscator
Copy link
Owner

Ah, cool. I've noticed the DCP-16xxW do not have eSCL, just WSD, so you can have both now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants