You are not logged in.

#1 2019-03-15 19:24:32

Morgoth42
Member
Registered: 2019-03-15
Posts: 2

[SOLVED] Brother ADS-2200/2700W - SANE - Driver/Permission Issues

Hello,

I bought a Brother ADS2200 scanner and I am trying to get it running under SANE. I need some help.
The ADS2200 is not supported by any of the Brother drivers mentioned on SANE/Scanner-specific problems (see compatibility list under ADS-scanner),
however, I gave a cursory try to get it running with brscan4, by addding a udev rule, to no avail.

As the next step I made the following PKGBUILD, adapted from the brscan4 PKGBUILD, which installs the official drivers by brother for the ADS2200.

# Maintainer:
license=('GPL' 'custom:Brother')
arch=('i686' 'x86_64')
pkgname=brscanads2200ads2700w
pkgver=0.1.15_1
pkgrel=1
pkgdesc="SANE drivers from Brother for ads-2200 and ads-2700w"
url="http://support.brother.com"
depends=('sane')

[ "$CARCH" = "x86_64" ] && pkg="dlf103483/${pkgname}-${pkgver/_/-}.x86_64.rpm" || pkg="dlf103483/${pkgname}-${pkgver/_/-}.i386.rpm"
[ "$CARCH" = "x86_64" ] && pkg_md5sum="23b8a721dacbe6356594d197d2972816" || pkg_md5sum="4c7a4a874ebf7769237755e492eb1f74"

source=("https://download.brother.com/welcome/$pkg"
	"http://www.brother.com/agreement/English_sane/agree.html")
md5sums=($pkg_md5sum
	 'ccffb9a6f6d436b21be25b0241068981')
build() {
    echo $'BrotherADS2200\nBrotherADS2700' > $srcdir/brscanads2200ads2700w.conf
    udev_rule='ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04f9", ATTR{idProduct}=="03fb", MODE="0664", ENV{libsane_matched}="yes"'
    echo $udev_rule > $srcdir/40-brscanads2200ads2700w.rules
}
package() {
    depends=('libjpeg6-turbo')
    mkdir $pkgdir/opt
    cp -r $srcdir/opt/brother/scanner/$pkgname $pkgdir/opt
    cp -r $srcdir/usr $pkgdir
    install -D -m644 $srcdir/agree.html $pkgdir/usr/share/licenses/$pkgname/LICENSE.html
    [ "$CARCH" = "x86_64" ] && mv $pkgdir/usr/lib64 $pkgdir/usr/lib
    
    #install sane-dll config file, so that the backend gets loaded.
    install -D -m644 $srcdir/brscanads2200ads2700w.conf $pkgdir/etc/sane.d/dll.d/brscanads2200ads2700w.conf
    
    #install the udev-rule
    install -D -m644 $srcdir/40-brscanads2200ads2700w.rules $pkgdir/etc/udev/rules.d/40-brscanads2200ads2700w.rules
    
    # move the links to the right direction
    cd $pkgdir/usr/lib/sane
    ln -sf libsane-BrotherADS2200.so.1.0.25 $pkgdir/usr/lib/sane/libsane-BrotherADS2200.so.1
    ln -sf libsane-BrotherADS2200.so.1 $pkgdir/usr/lib/sane/libsane-BrotherADS2200.so
    
    ln -sf libsane-BrotherADS2700.so.1.0.25 $pkgdir/usr/lib/sane/libsane-BrotherADS2700.so.1
    ln -sf libsane-BrotherADS2700.so.1 $pkgdir/usr/lib/sane/libsane-BrotherADS2700.so
}

The following udev-rule is installed by this:

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04f9", ATTR{idProduct}=="03fb", MODE="0664", ENV{libsane_matched}="yes"

This rule correctly identifies the scanner (015 in this case),

myusername-arch% ll
total 0
drwxr-xr-x  2 root root          80 Mar 15 19:17 .
drwxr-xr-x  8 root root         160 Mar 15 17:22 ..
crw-rw-r--  1 root root    189, 128 Mar 15 16:22 001
crw-rw-r--+ 1 root scanner 189, 142 Mar 15 19:17 015

myusername-arch% udevadm info --name=/dev/bus/usb/002/015 
P: /devices/pci0000:00/0000:00:1c.4/0000:05:00.0/usb2/2-1
N: bus/usb/002/015
L: 0
E: DEVPATH=/devices/pci0000:00/0000:00:1c.4/0000:05:00.0/usb2/2-1
E: DEVNAME=/dev/bus/usb/002/015
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=4f9/3fb/233
E: TYPE=0/0/0
E: BUSNUM=002
E: DEVNUM=015
E: MAJOR=189
E: MINOR=142
E: SUBSYSTEM=usb
E: USEC_INITIALIZED=10518381693
E: ID_VENDOR=Brother
E: ID_VENDOR_ENC=Brother
E: ID_VENDOR_ID=04f9
E: ID_MODEL=ADS-2200
E: ID_MODEL_ENC=ADS-2200
E: ID_MODEL_ID=03fb
E: ID_REVISION=0233
E: ID_SERIAL=Brother_ADS-2200_E77668B8X112385
E: ID_SERIAL_SHORT=E77668B8X112385
E: ID_BUS=usb
E: ID_USB_INTERFACES=:ffcc00:
E: ID_VENDOR_FROM_DATABASE=Brother Industries, Ltd

(note that the scanner group is set by a udev-rule in from the sane-package) and the uaccess tag seems to be set correctly as well:

myusername-arch% getfacl 015 
# file: 015
# owner: root
# group: scanner
user::rw-
user:myusername:rw-
group::rw-
mask::rw-
other::r--

Furthermore scanimage lists the scanner.

myusername-arch% scanimage -L
device `BrotherADS2200:libusb:002:015' is a Brother ADS2200 USB scanner

But alas, the following command fails after about 2 minutes:

myusername-arch% scanimage BrotherADS2200:libusb:002:015 --format=tiff > ~/Pictures/test.tiff
scanimage: open of device BrotherADS2200:libusb:002:015 failed: Access to resource has been denied 

I am a little puzzled by this, so I would be grateful for any ideas.

Edit:
I forgot to say, I am in the scanner group.

Last edited by Morgoth42 (2019-03-16 10:53:25)

Offline

#2 2019-03-16 10:53:04

Morgoth42
Member
Registered: 2019-03-15
Posts: 2

Re: [SOLVED] Brother ADS-2200/2700W - SANE - Driver/Permission Issues

Okay, It works when I plug in the scanner in a different usb-port. Specifically one on the back-panel. The one I used was a non direct-mainboard port. I feel kinda stupid.

Offline

Board footer

Powered by FluxBB