SimulPiscator / AirSane

Publish SANE scanners to MacOS, Android, and Windows via Apple AirScan.
GNU General Public License v3.0
247 stars 26 forks source link

Out of memory error with Brother DCP-7030 #39

Closed herbstrevolver closed 3 years ago

herbstrevolver commented 3 years ago

I am trying to make the scanner part of a Brother DCP-7030 work with AirSane but it keeps failing: Whether I start the scan via the AirSane web interface or via "Image Capture" on a Mac, the scanner makes it's starting noises but then stops after a second or so. Meanwhile scanning with scanimage works perfectly fine.

AirSane debug mode always reports sane_read(0x7f895c1098b0): Out of memory

Output from sudo airsaned --debug=true --access-log=-:

reading device options from '/etc/airsane/options.conf'
enumerating local devices...
sane_init(nullptr, nullptr)
sane_get_devices() ...
... sane_get_devices() -> SANE_Status Success
sane_exit()
found: brother3:bus2;dev1 (Brother DCP-7030)
sane_init(nullptr, nullptr)
sane_open(brother3:bus2;dev1) -> 0x7f811c136c70
[source] := "FlatBed"
sane_close(0x7f811c136c70)
sane_exit()
stable unique name: brother3:Brother DCP-7030:1
uuid: 2bd3004d-341f-5655-abba-3dccc99c3448
/etc/airsane/options.conf: regex 'brother3:.*' matches device name 'brother3:bus2;dev1'
published as 'Brother DCP-7030'
listening on 127.0.0.1:8090
listening on 192.168.178.22:8090
listening on 172.17.0.1:8090
listening on 172.18.0.1:8090
listening on [::1]:8090
listening on [fe80::7285:c2ff:fe30:f4df]:8090
listening on [fe80::42:2dff:febf:4f11]:8090
listening on [fe80::20bd:c6ff:fef2:47f5]:8090
192.168.178.35 - - [14/Nov/2020:14:15:46 +0100] "GET /" 200 516 "" "Mozilla/5.0(Macintosh;IntelMacOSX10_15_7)AppleWebKit/605.1.15(KHTML,likeGecko)Version/14.0.1Safari/605.1.15"
192.168.178.35 - - [14/Nov/2020:14:15:46 +0100] "GET /" 200 516 "" "Mozilla/5.0(Macintosh;IntelMacOSX10_15_7)AppleWebKit/605.1.15(KHTML,likeGecko)Version/14.0.1Safari/605.1.15"
192.168.178.35 - - [14/Nov/2020:14:15:48 +0100] "GET /2bd3004d-341f-5655-abba-3dccc99c3448" 200 2896 "http://192.168.178.22:8090/" "Mozilla/5.0(Macintosh;IntelMacOSX10_15_7)AppleWebKit/605.1.15(KHTML,likeGecko)Version/14.0.1Safari/605.1.15"
document format requested: image/jpeg
document format used: image/jpeg
using grayscale gamma of 0.555555
sane_init(nullptr, nullptr)
sane_open(brother3:bus2;dev1) -> 0x7f895c1098b0
[mode] := "True Gray" -> reload options
[source] := ""
[resolution] := 300dpi
[tl-x] := 0mm
[tl-y] := 0mm
[br-x] := 210mm
[br-y] := 297mm
sane_start(0x7f895c1098b0) with options:
[br-x] = 209.981mm
[br-y] = 296.973mm
[brightness] = 0%
[contrast] = 0%
[mode] = "True Gray"
[resolution] = 300dpi
[source] = "FlatBed"
[tl-x] = 0mm
[tl-y] = 0mm
sane_read(0x7f895c1098b0): Out of memory
sane_cancel(0x7f895c1098b0)
sane_close(0x7f895c1098b0)
sane_exit()
192.168.178.35 - - [14/Nov/2020:14:15:56 +0100] "POST /2bd3004d-341f-5655-abba-3dccc99c3448" 200 0 "http://192.168.178.22:8090/2bd3004d-341f-5655-abba-3dccc99c3448" "Mozilla/5.0(Macintosh;IntelMacOSX10_15_7)AppleWebKit/605.1.15(KHTML,likeGecko)Version/14.0.1Safari/605.1.15"

Output from sudo scanimage -d "brother3:bus2;dev1" -A:

All options specific to device `brother3:bus2;dev1':
  Mode:
    --mode Black & White|Gray[Error Diffusion]|True Gray|24bit Color [24bit Color]
        Select the scan mode
    --resolution 100|150|200|300|400|600|1200|2400|4800|9600dpi [200]
        Sets the resolution of the scanned image.
    --source FlatBed [FlatBed]
        Selects the scan source (such as a document-feeder).
    --brightness -50..50% (in steps of 1) [inactive]
        Controls the brightness of the acquired image.
    --contrast -50..50% (in steps of 1) [inactive]
        Controls the contrast of the acquired image.
  Geometry:
    -l 0..215.9mm (in steps of 0.0999908) [0]
        Top-left x position of scan area.
    -t 0..355.6mm (in steps of 0.0999908) [0]
        Top-left y position of scan area.
    -x 0..215.9mm (in steps of 0.0999908) [215.88]
        Width of scan-area.
    -y 0..355.6mm (in steps of 0.0999908) [355.567]
        Height of scan-area.

I have to note that the reported resolutions seem not correct as the scanner only supports 100, 200, 300 and 600 dpi.

Addition: I see now that airsane reports my experiments with the config file in line /etc/airsane/options.conf: regex 'brother3:.*' matches device name 'brother3:bus2;dev1'. I tried to set default options for the printer as I suspected wrong default settings (like the scan area), but this didn't help.

SimulPiscator commented 3 years ago

I found a similar problem reported for the brother4 driver here: http://technik.blogs.nde.ag/2013/12/06/brother-dcp-j925dw-problems-when-scanning-via-sane/ There, scanning locally would work but not remotely via saned. The brother4 driver seemed to behave differently depending on which executable it was loaded from. The workaround was to use the brother2 driver, but the brother4 driver has reportedly been fixed since then. So a possible solution for you might be to switch to the brother4 driver, if that supports your scanner.

herbstrevolver commented 3 years ago

So a possible solution for you might be to switch to the brother4 driver, if that supports your scanner.

That's sadly not the case. The scanner only works with its "brother3" driver – to my knowledge there are only a few cases where multiple Brother drivers work for one Brother scanner device.

In the last few months I didn't have much time any more to dig deeper into this issue, though I did some experiments a while ago. It seems like a buffer in SANE or between SANE and the driver is overflowing due to a poorly working driver. In the end, the scanning process via SANE can be accomplished for resolutions up to 200 dpi black&white but that's it more or less. It's really not stable.

Thank you very much for your support, I'll close this issue since this is very scanner specific (or related to SANE) and not directly related to AirSane as such.

RGarrido03 commented 1 year ago

Hi @herbstrevolver! Have you been able to get rid of that "out of memory" issue? I have a Brother DCP-197C with the same problem (and also brother3 driver). Thanks!

herbstrevolver commented 1 year ago

@RGarrido03 No, sadly not. As I've written before it seems to be a problem of the underlying brother3 drivers or SANE itself. Debugging would need some deeper knowledge of SANE that I don't possess.

For my scanning needs I switched to the Brother tool brscan-skey which allows me to scan to a file on my home server by pressing a button on the printer. The files are put in a samba share (basically, brscan-skey triggers a bash script, so you can do pretty much everything…).