Git Product home page Git Product logo

brother-scand's Introduction

Brother scanner network driver

This repository is no longer maintained. Please check out the @rumpeltux fork at https://github.com/rumpeltux/brother-scand

Status License

Functional userspace driver for Brother scanners.

This is a server for brother click-to-scan feature. To scan, simply press a button on the scanner.

This is a cross-platform, open-source and headless equivalent of Brother's Control Center 4.

Written in C11. Does not use any external dependencies.

Advantages over the official Linux driver

Brother released a Linux driver for their scanners, however...

The official Linux driver uses click-to-scan Brother protocol only to notify about the button press event. After receiving such event, the driver closes the connection and starts up separate SANE application that will establish connection with the same scanner (again!) and will request single page scan.

As for DCP-J105 scanner model, the connection establishment + handshake takes around 3 seconds. To scan a single page, one would have to wait at least 6 seconds before the actual scanning starts.

The press-to-scan protocol offers much more than. It can be used to receive entire image data within the same (original) connection. But only on Windows... Well, not anymore!

Features

  • All the Windows Control Center 4 features, including:
    • Scan to IMAGE, OCR, EMAIL, FILE
    • Configurable scan params (DPI, Dimensions, Brightness, Contrast, Color, Compression)
    • Scan multiple pages with almost no interval (~ 0 sec)
    • Multiple scanners support
  • Password-protected hosts (a feature apparently not implemented in Control Center 4)
  • External scan hooks
  • Minimal resource usage when idle
  • Configurable hostname :)

Installation

git clone https://github.com/darsto/brother-scanner-driver.git
cd brother-scanner-driver
make
cd out
vi ./brother.config
chmod +x ./scanhook.sh
../build/brother-scand

The driver should work for the most of Brother devices. However, it has only been tested on the DCP-J105.

If you have successfully run this driver with a different model, please open a github issue.

brother-scand's People

Contributors

darsto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

brother-scand's Issues

MFC-J430W support

First, great job with this tool! Thank you, I’ve been hating that proprietary driver forever.

I managed to get my scanner to work with minimal modifications as you can see in rumpeltux@0bdfbe4
(not sure that patch is the right way to approach the problem, but it did the trick for me)

Essentially the message sent by my scanner looks like this:

0040 … … 00 1a 00 31 30 30 2c 31 30 30 2c 32 2c 32 .....100,100,2,2
0050 30 39 2c 38 32 36 2c 32 39 34 2c 31 31 35 37 09,826,294,1157

So there’s no trailing 0.

Another example (this time from ADF, thus no limit on image height):
{
00000000: 3014 0046 3d46 494c 450a 443d 5349 4e0a | 0..F=FILE.D=SIN.
00000010: 453d 5348 4f0a 80 | E=SHO..
}
{
00000000: 1b49 0a44 3d53 494e 0a4d 3d43 4752 4159 | .I.D=SIN.M=CGRAY
00000010: 0a52 3d31 3030 2c31 3030 0a80 | .R=100,100..
}
{
00000000: 0015 0031 3030 2c31 3030 2c31 2c32 3039 | ...100,100,1,209
00000010: 2c38 3236 2c30 2c30 | ,826,0,0
}
{
00000000: 1b58 0a41 3d30 2c30 2c38 3236 2c30 0a42 | .X.A=0,0,826,0.B
00000010: 3d35 300a 433d 4a50 4547 0a44 3d53 494e | =50.C=JPEG.D=SIN
00000020: 0a47 3d31 0a4a 3d4d 4944 0a4c 3d31 3238 | .G=1.J=MID.L=128
00000030: 0a4d 3d43 4752 4159 0a4e 3d35 300a 523d | .M=CGRAY.N=50.R=
00000040: 3130 302c 3130 300a 80 | 100,100..
}

ADF produces invalid images

The automated document feed function is a bit broken as it produces (incomplete) JPEG images with dimensions that tools can’t open:

$ file scan0.jpg 
scan0.jpg: JPEG image data, JFIF standard 1.02, resolution (DPI), density 100x100, segment length 16, baseline, precision 8, 826x65535, frames 3

accordingly also the receiving data: estimate is wrong.

Not sure if the tool can easily fix this. Otherwise some external processing can probably fix the header and make the image openable.
A quick hack that doesn’t take the actual image height into account is:

echo "a5: 0f" | xxd -r - scan0.jpg

Sources problem

There is a problem with getting driver sources.

Here is a log i got while following installation guideline:

rumcajs@rumcajs-pc:/home/rumcajs/Projekty$ git clone https://github.com/darsto/brother-scanner-driver.git
Cloning into 'brother-scanner-driver'...
remote: Counting objects: 524, done.
remote: Total 524 (delta 0), reused 0 (delta 0), pack-reused 524
Receiving objects: 100% (524/524), 102.27 KiB | 0 bytes/s, done.
Resolving deltas: 100% (341/341), done.
rumcajs@rumcajs-pc:~/Projekty$ cd brother-scanner-driver
rumcajs@rumcajs-pc:~/Projekty/brother-scanner-driver(master)$ mkdir build
rumcajs@rumcajs-pc:~/Projekty/brother-scanner-driver(master)$ cd build
rumcajs@rumcajs-pc:~/Projekty/brother-scanner-driver/build(master)$ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Error at CMakeLists.txt:25 (add_executable):
  Cannot find source file:

    ber/ber.c

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx


CMake Error: CMake can not determine linker language for target: brother
CMake Error: Cannot determine link language for target "brother".
-- Generating done
-- Build files have been written to: /home/rumcajs/Projekty/brother-scanner-driver/build

I tried to clone ber with git submodule, but i got:

rumcajs@rumcajs-pc:/home/rumcajs/Projekty/brother-scanner-driver(master)$ git submodule init
Submodule 'ber' ([email protected]:darsto/ber.git) registered for path 'ber'
rumcajs@rumcajs-pc:~/Projekty/brother-scanner-driver(master)$ git submodule update
Cloning into '/home/rumcajs/Projekty/brother-scanner-driver/ber'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:darsto/ber.git' into submodule path '/home/rumcajs/Projekty/brother-scanner-driver/ber' failed
Failed to clone 'ber'. Retry scheduled
Cloning into '/home/rumcajs/Projekty/brother-scanner-driver/ber'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:darsto/ber.git' into submodule path '/home/rumcajs/Projekty/brother-scanner-driver/ber' failed
Failed to clone 'ber' a second time, aborting

However cloning ber as standalone project works:

rumcajs@rumcajs-pc:/home/rumcajs/Projekty$ git clone https://github.com/darsto/cber.git
Cloning into 'cber'...
remote: Counting objects: 205, done.
remote: Total 205 (delta 0), reused 0 (delta 0), pack-reused 205
Receiving objects: 100% (205/205), 40.91 KiB | 0 bytes/s, done.
Resolving deltas: 100% (126/126), done.

Missing features for the 1.0 release

  • add scanner unregister msg
  • add configurable default scan settings
  • add scan hooks / proper scan func support
  • remove all input checking asserts / replace with proper error checking

Async message retrieve

If current driver receives a couple of interrupts, the SNMP thread might process any received message as an (invalid) response to a completely different request.

A special message handler with request_id handler should be implemented.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.