1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

brscan3 scanner drivers - compile manually?

Discussion in 'Tomato Firmware' started by theminor, Oct 11, 2011.

  1. theminor

    theminor Networkin' Nut Member

    I have optware set up on my Tomato router (RT-N16) and my brother printer (an "all-in-one" MFC machine) is plugged into one of the USB ports. Printer sharing works great, but I'd like to get the scanner working. I've installed sane-backends and all the prereqs as per various guides I've found to get sane working. All appears to be working well, except the drivers for my Brother MFC (brscan3) are not installed and are not included in the ipkg list. If I run the following, I get:

    Code:
    # sane-find-scanner
    found USB scanner (vendor=0x04f9, product=0x01e7) at libusb:002:003
    
    # scanimage -L
    No scanners were identified. If you were expecting something different,
    check that the scanner is plugged in, turned on and detected by the
    sane-find-scanner tool (if appropriate). Please read the documentation
    which came with this software (README, FAQ, manpages).
    
    Apparently, I need brscan3, which is available on the Brother website (here) in .deb and .rpm formats. Source code is also available. I assume there is no way to "convert" a deb or rpm package to an ipkg. So what would be the easiest way to compile this driver myself from source? I don't have gcc installed, but there appears to be a package called "crosstool-native" that includes build utilities. The notes say it is over 100 MB, however, and I'm not sure the RT-N16 would be the best build environmental... Can someone give me some guidance to compiling this driver (preferably somehow compiling on a separate machine) or some other way to get these drivers installed on the RT-N16 somehow? Any help would be greatly appreciated!

    Thanks in advance...
     
  2. rhester72

    rhester72 Network Guru Member

    I might be missing the obvious here, but I don't see source code on that page. What's the URL?

    UPDATE: Never mind, I found it.

    Rodney
     
  3. rhester72

    rhester72 Network Guru Member

    The Makefile.in file is missing in the source - without that, you're getting nowhere fast.

    That isn't terribly surprising, unfortunately - many manufacturers fail to actually test the build process before they slap a tarball together in the name of the GPL and throw it on a web server.

    I'm happy to assist with the compile if you can find a complete tarball. The one I used is from:

    http://www.brother.com/pub/bsc/linux/dlf/brscan3-src-0.2.11-4.tar.gz

    Rodney
     
  4. theminor

    theminor Networkin' Nut Member

    Thanks Rodney - very frustrating that Makefile.in is not included!

    I attempted to create a Makefile.in based on the Makefile.in from the brscan2 source (very similar to brscan3) and looking at the changes from Makefile to Makefile between the brscan2 and brscan3 sources. This is what I came up with:

    Code:
    SHELL = /bin/sh
    
    VPATH = @srcdir@
    srcdir = @srcdir@
    top_srcdir = @top_srcdir@
    top_builddir = .
    
    PACKAGE = @PACKAGE@
    VERSION = @VERSION@
    distdir = $(PACKAGE)-$(VERSION)
    
    prefix = @prefix@
    exec_prefix = @exec_prefix@
    bindir = @bindir@
    sbindir = @sbindir@
    libexecdir = @libexecdir@
    datadir = @datadir@
    sysconfdir = @sysconfdir@
    sharedstatedir = @sharedstatedir@
    localstatedir = @localstatedir@
    libdir = @libdir@
    infodir = @infodir@
    mandir = @mandir@
    includedir = @includedir@
    oldincludedir = /usr/include
    
    MKDIR = $(top_srcdir)/mkinstalldirs
    INSTALL = @INSTALL@
    INSTALL_PROGRAM = @INSTALL_PROGRAM@
    INSTALL_DATA = @INSTALL_DATA@
    
    @SET_MAKE@
    
    SUBDIRS    = backend_brscan3
    
    DISTFILES = AUTHORS COPYING ChangeLog ChangeLog-1.0.0 ChangeLog-1.0.1 \
      ChangeLog-1.0.2 ChangeLog-1.0.3 ChangeLog-1.0.4 ChangeLog-1.0.5 LEVEL2 \
      LICENSE Makefile.in NEWS \
      PROBLEMS PROJECTS README README.aix README.hp-ux README.linux README.netbsd \
      README.openbsd README.os2 README.solaris README.unixware2 README.unixware7 \
      TODO acinclude.m4 aclocal.m4 config.guess config.sub configure \
      configure.in configure.os2 install-sh ltconfig ltmain.sh mkinstalldirs \
      sane-backends.lsm
    
    .PHONY: all all-recursive clean clean-recursive depend \
      depend-recursive dist install install-recursive libcheck lsm \
      sane-backends sort-cvsignore uninstall uninstall-recursive
    
    all:    brscan3
    
    brscan3:
        (cd backend_brscan3 && make brscan3)
        (cd netconfig3 && sh mk_brsaneconfig3 3)
        (cd mk_package3/G7  && make)
    
    clean: clean-recursive
    
    distclean: clean distclean-recursive
        rm -f *~ *.log *.bak
        rm -f Makefile config.cache config.status
        rm -rf $(distdir)
    
    depend: depend-recursive
    
    all-recursive install-recursive clean-recursive distclean-recursive \
    depend-recursive uninstall-recursive:
        @for subdir in $(SUBDIRS); do        \
          target=`echo $@ | sed s/-recursive//`; \
          echo making $$target in $$subdir;    \
          (cd $$subdir && $(MAKE) $$target)    \
          || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
        done && test -z "$$fail"
    
    dist: $(DISTFILES)
        rm -fr $(distdir)
        $(MKDIR) $(distdir)
        for file in $(DISTFILES); do \
          ln $$file $(distdir) 2>/dev/null || cp -p $$file $(distdir); \
        done
    #    for subdir in $(SUBDIRS) japi testsuite ; do \
    #      mkdir $(distdir)/$$subdir || exit 1; \
    #      chmod 777 $(distdir)/$$subdir; \
    #      (cd $$subdir && $(MAKE) $@) || exit 1; \
    #    done
        tar chzf $(distdir).tar.gz $(distdir)
        rm -fr $(distdir)
    
    Hopefully (possibly?) it will work... Would you mind giving it a shot or helping me complete the compile myself?

    Again, thanks a ton ...
     
  5. rhester72

    rhester72 Network Guru Member

    No luck - there are other files missing as well, and some of the included ones are clearly for brscan2.

    I've abandoned that for now and am trying to compile brscan2 with the Linksys SDK, which has problems of its own (clearly NOBODY at Brother ever tried to compile this as packaged!), but I'm at least making more progress...the idea being that once I can get it to compile, I ought to be able to lift a good part of the configure/Makefile.in infrastructure over to brscan3 and make it work. It will definitely be slow going, though.

    Rodney
     
  6. theminor

    theminor Networkin' Nut Member

    Wow thanks for doing all this. Very disappointing that the source Brother has posted is so lame. I suppose brscan2 might just work for my scanner anyway (worth a shot), but hopefully the infrastructure can be "ported" to the brscan3 source to get it to work as you suggest. Please let me know if there is anything I can do to help. I REALLY appreciate it!
     
  7. rhester72

    rhester72 Network Guru Member

    I ended up finally putting together something close to what I think they intended all along - amounting to a 14K patch (!) against the original distribution.

    The library you're looking for should be on my site now under PRECOMPILED/libs/brscan3 (http://multics.minidns.net/tomato/PRECOMPILED/lib/brscan3/), but I've honestly no experience whatsoever with SANE and have no idea how it's used. Please note that your Brother-specific config files were moved under /opt (/usr/local/Brother/sane/...), since we can't write to /usr on Tomato.

    I included brsaneconfig3 but _not_ brscan-skey (since it's part of a separate package).

    I also did not include libbrscandec2.so, which is interesting because:

    - From what I read, it's only available from Brother in precompiled binary form (to wit, http://old.nabble.com/Brother-has-a...uld-they-go-to-sane-backends--td24331488.html)
    - It doesn't show up in the ldd dependencies but does appear to at least attempt to be demand-loaded by the Brother SANE library

    So, long story short...if you're incredibly lucky, maybe you'll get my binary to do something useful, or at least interesting. If not, yell at me here and I'll see what I can do (as long as it has nothing to do with Brother binary-only dependencies and as time permits).

    Rodney
     
  8. theminor

    theminor Networkin' Nut Member

    Awesome! Thanks so much for spending the time on this - I really appreciate it. I don't have it working yet, but I'm getting there. I'm trying to determine how to get the libraries installed. I've found where to put libsane-brother3.so.1.0.7 (copied to /opt/lib/sane/) which is where all the other scanner libraries are that were installed with the sane package. Then make the library executable and created system links similar to the other libraries in there.

    I'm not sure where the other library goes (libsane.so.1.0.7). I'm weeding through the sane documentation to get an understanding of how it works. So far, sane-find-scanner reports that my scanner is found, listing the vendor and product codes, as reporting that it was found at "libusb:002:003". However, "scanimage -L" returns that "No scanners were identified" which I have read means there is no configuration file setup for this model. I've tried creating one called brother3.conf and putting in the vendor and product IDs but no dice yet. I'll keep working on it and let you know.

    Any idea where libsane.so.1.0.7 goes?

    Thanks again!
     
  9. rhester72

    rhester72 Network Guru Member

    Some thoughts:

    - If you don't have it, you need libjpeg.so.8, preferably installed in /opt/usr/lib
    - While there is no direct dependency, it may be looking for libsane.so.1 in the same (i.e. /opt/usr/lib) directory (though I would surely have thought that would be included with the sane package itself - I don't know why the source builds it). I've linked/copied the libraries according to what it's looking for (i.e. dropping the minor revision numbers). It might also want it in /opt/lib (or /opt/lib/sane, or not at all), I don't know.
    - The libraries as previously compiled expect things in /opt/usr/lib/sane, but you're using /opt/lib/sane, so I've recompiled to match that (pick up a fresh copy). What are the locations of the other paths of interest? These are all the ones I can find:

    /opt/etc/sane.d
    /opt/usr/bin/brscan-skey
    /opt/usr/local/Brother/sane/
    /opt/usr/local/Brother/sane/Brsane3.ini
    /opt/usr/local/Brother/sane/brsanenetdevice3.cfg
    /opt/usr/local/Brother/sane/models3

    (Note that the above all had a "2" where the "3" is with the new compile - the suffix number was hardcoded, presumably incorrectly, in the Makefile template.)
    Any of these can be adjusted at compile-time, I just don't know what the optware installation expects.
    - The following backends are disabled (by default) and I don't know if they are needed...again, my lack of SANE experience isn't helping much. ;) If you know for certain any of them are required, let me know: GPHOTO2, PINT, SM3600
    - Don't forget there's still the matter of the missing libbrscandec3.so binary-only library

    Rodney
     
  10. rhester72

    rhester72 Network Guru Member

  11. rhester72

    rhester72 Network Guru Member

    Ah - from the installer, it looks like the contents of the models3 directory should be the ext*.ini files from:

    http://multics.minidns.net/tomato/brscan3-src-0.2.11-4/brscan/mk_package3/G7/

    It also shows brsaneconfig3 placed in /opt/usr/local/Brother/sane with a softlink to /opt/usr/bin.

    Also, the file /etc/sane.d/dll.conf (or maybe /opt/etc/sane.d.dll.conf?) looks like it should contain the single string "brother3" (no quotes).

    Unfortunately, the installer makes it pretty clear that libbrscandec2.so.1.0.0 (linked as libbrscandec3.so) is required (also see http://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg102750.html and more importantly http://www.amigaworld.net/modules/n...29501&forum=34&start=20&viewmode=flat&order=0).

    Rodney

    P.S.: Sorry for the mess of explanations and suggestions, you're getting them pretty much real-time. ;)
     
  12. theminor

    theminor Networkin' Nut Member

    Hmmm - there are a lot of issues, so I'm trying to take them one at a time. Its like if I can get the driver recognized, other configuration issues will be easier to diagnose. Binaries for brsaneconfig3 appear to not be included in the source (on purpose by brother) and we already know libbrscandec3.so is not included... These may be the ultimate problem that will make this impossible, but I am able to determine that the libsane-brother3.so.1.0.7 library is definitely not being loaded. I added "brother3" to dll.conf and it attempts to load it, but says the file is not found (even though the file is definitely there!):

    Code:
    # SANE_DEBUG_DLL=255 scanimage -L
    [sanei_debug] Setting debug level of dll to 255.
    [dll] sane_init: SANE dll backend version 1.0.13 from sane-backends 1.0.22
    [dll] sane_init/read_dlld: attempting to open directory `./dll.d'
    [dll] sane_init/read_dlld: attempting to open directory `/opt/etc/sane.d/dll.d'
    [dll] sane_init/read_dlld: using config directory `/opt/etc/sane.d/dll.d'
    [dll] sane_init/read_dlld: done.
    [dll] sane_init/read_config: reading dll.conf
    [dll] add_backend: adding backend `net'
    . . .
    [dll] add_backend: adding backend `brother3'
    . . .
    
    [dll] sane_get_devices
    [dll] load: searching backend `xerox_mfp' in `/opt/lib/sane'
    [dll] load: trying to load `/opt/lib/sane/libsane-xerox_mfp.so.1'
    [dll] load: dlopen()ing `/opt/lib/sane/libsane-xerox_mfp.so.1'
    [dll] init: initializing backend `xerox_mfp'
    [dll] init: backend `xerox_mfp' is version 1.0.12
    . . .
    [dll] load: searching backend `brother3' in `/opt/lib/sane'
    [dll] load: trying to load `/opt/lib/sane/libsane-brother3.so.1'
    [dll] load: dlopen()ing `/opt/lib/sane/libsane-brother3.so.1'
    [dll] load: dlopen() failed (File not found)
    . . .
    
    [dll] sane_get_devices: found 0 devices
    
    No scanners were identified. If you were expecting something different,
    check that the scanner is plugged in, turned on and detected by the
    sane-find-scanner tool (if appropriate). Please read the documentation
    which came with this software (README, FAQ, manpages).
    [dll] sane_exit: exiting
    [dll] sane_exit: calling backend `xerox_mfp's exit function
    . . .
    [dll] sane_exit: finished
    
    (code snipped where I inserted ". . .")

    So it says "dlopen() failed (File not found)" but "/opt/lib/sane/libsane-brother3.so.1" is definitely there (it is a system link to your "libsane-brother3.so.1.0.7" in the same directory - which is exactly how all the other libraries are set up. So I'm not sure why it is not loading, even though it is clearly looking for it...
     
  13. rhester72

    rhester72 Network Guru Member

    Run scanimage with strace. Dollars to donuts it's loading libsane-brother3.so.1 but failing a dependency load on libbrscandec3.so.1.

    Rodney
     
  14. theminor

    theminor Networkin' Nut Member

    Great suggestion running strace. Now your previous posts are much more clear and I was able to put the files you reference in the correct places. I had to create /opt/usr/local and everything under that, but after creating that and moving those files you reference in posts above, I make more progress. Now scanimage actually starts to initialize the brother3 backend, but then craps out with a "segmentation fault". Interestingly, it does not try load libbrscandec3.so.1 (yet?) from best I can tell. Here is what looks to be the relavant portions of my latest strace:

    Code:
    open("/opt/lib/sane/libsane-brother3.so.1", O_RDONLY) = 3
    old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaf000
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\2202\0\0004\0\0\0"..., 4096) = 4096
    old_mmap(NULL, 147456, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8b1000
    old_mmap(0x2b8b1000, 74680, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x2b8b1000
    old_mmap(0x2b8d4000, 1620, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x13000) = 0x2b8d4000
    close(3)                                = 0
    munmap(0x2aaaf000, 4096)                = 0
    open("/opt/lib/libnsl.so.0", O_RDONLY)  = 3
    old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaf000
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0p\3\0\0004\0\0\0"..., 4096) = 1628
    old_mmap(NULL, 69632, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8d5000
    old_mmap(0x2b8d5000, 936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x2b8d5000
    old_mmap(0x2b8e5000, 972, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x2b8e5000
    close(3)                                = 0
    munmap(0x2aaaf000, 4096)                = 0
    open("/opt/lib/libjpeg.so.8", O_RDONLY) = 3
    old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2aaaf000
    read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0P(\0\0004\0\0\0"..., 4096) = 4096
    old_mmap(NULL, 274432, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b8e6000
    old_mmap(0x2b8e6000, 203632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x2b8e6000
    old_mmap(0x2b928000, 1196, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x32000) = 0x2b928000
    close(3)                                = 0
    munmap(0x2aaaf000, 4096)                = 0
    munmap(0x2aab0000, 1551)                = 0
    stat("/proc/bus/usb", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
    open("/proc/bus/usb", O_RDONLY)        = 3
    fcntl(3, F_SETFD, FD_CLOEXEC)          = 0
    getdents(3, /* 5 entries */, 3933)      = 84
    getdents(3, /* 0 entries */, 3933)      = 0
    close(3)                                = 0
    stat("/proc/bus/usb/002", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
    open("/proc/bus/usb/002", O_RDONLY)    = 3
    fcntl(3, F_SETFD, FD_CLOEXEC)          = 0
    getdents(3, /* 5 entries */, 3933)      = 80
    open("/proc/bus/usb/002/003", O_RDWR)  = 4
    ioctl(4, USBDEVFS_CONNECTINFO, 0x7fcb5a58) = 0
    read(4, "\22\1\0\2\0\0\0@\371\4\347\1\0\1\0\0\3\1", 18) = 18
    read(4, "\t\2N\0\3\1\0\300", 8)        = 8
    close(4)                                = 0
    open("/proc/bus/usb/002/002", O_RDWR)  = 4
    ioctl(4, USBDEVFS_CONNECTINFO, 0x7fcb5a58) = 0
    read(4, "\22\1\20\1\t\0\0\10\217\5T\222\22\3\1\2\0\1", 18) = 18
    read(4, "\t\2\31\0\1\1\0\340", 8)      = 8
    read(4, "2\t\4\0\0\1\t\0\0\0\7\5\201\3\1\0\377", 17) = 17
    close(4)                                = 0
    open("/proc/bus/usb/002/001", O_RDWR)  = 4
    ioctl(4, USBDEVFS_CONNECTINFO, 0x7fcb5a58) = 0
    read(4, "\22\1\20\1\t\0\0@k\35\1\0\6\2\3\2\1\1", 18) = 18
    read(4, "\t\2\31\0\1\1\0\340", 8)      = 8
    read(4, "\0\t\4\0\0\1\t\0\0\0\7\5\201\3\2\0\377", 17) = 17
    close(4)                                = 0
    getdents(3, /* 0 entries */, 3933)      = 0
    close(3)                                = 0
    open("/proc/bus/usb/002/003", O_RDWR)  = 3
    ioctl(3, USBDEVFS_IOCTL, 0x7fcb7608)    = -1 ENOTTY (Inappropriate ioctl for device)
    close(3)                                = 0
    open("/proc/bus/usb/002/002", O_RDWR)  = 3
    ioctl(3, USBDEVFS_IOCTL, 0x7fcb7608)    = 5
    close(3)                                = 0
    open("/proc/bus/usb/002/001", O_RDWR)  = 3
    ioctl(3, USBDEVFS_IOCTL, 0x7fcb7608)    = 3
    close(3)                                = 0
    stat("/proc/bus/usb/001", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
    open("/proc/bus/usb/001", O_RDONLY)    = 3
    fcntl(3, F_SETFD, FD_CLOEXEC)          = 0
    getdents(3, /* 4 entries */, 3933)      = 64
    open("/proc/bus/usb/001/003", O_RDWR)  = 4
    ioctl(4, USBDEVFS_CONNECTINFO, 0x7fcb5a58) = 0
    read(4, "\22\1\0\2\0\0\0@\201\7QQ\20\0\1\2\3\1", 18) = 18
    read(4, "\t\2 \0\1\1\0\200", 8)        = 8
    read(4, "d\t\4\0\0\2\10\6P\0\7\5\201\2\0\2\0\7\5\1\2\0\2\1", 24) = 24
    close(4)                                = 0
    open("/proc/bus/usb/001/001", O_RDWR)  = 4
    ioctl(4, USBDEVFS_CONNECTINFO, 0x7fcb5a58) = 0
    read(4, "\22\1\0\2\t\0\0@k\35\2\0\6\2\3\2\1\1", 18) = 18
    read(4, "\t\2\31\0\1\1\0\340", 8)      = 8
    read(4, "\0\t\4\0\0\1\t\0\0\0\7\5\201\3\4\0\f", 17) = 17
    close(4)                                = 0
    getdents(3, /* 0 entries */, 3933)      = 0
    close(3)                                = 0
    open("/proc/bus/usb/001/003", O_RDWR)  = 3
    ioctl(3, USBDEVFS_IOCTL, 0x7fcb7608)    = -1 ENOTTY (Inappropriate ioctl for device)
    close(3)                                = 0
    open("/proc/bus/usb/001/001", O_RDWR)  = 3
    ioctl(3, USBDEVFS_IOCTL, 0x7fcb7608)    = 3
    close(3)                                = 0
    stat("/opt/usr/local/Brother/sane/models3", {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
    open("/opt/usr/local/Brother/sane/models3", O_RDONLY) = 3
    fcntl(3, F_SETFD, FD_CLOEXEC)          = 0
    getdents(3, /* 9 entries */, 984)      = 180
    open("/opt/usr/local/Brother/sane/models3/ext1.ini", O_RDONLY) = 4
    ioctl(4, TIOCNXCL, 0x7fcb6a28)          = -1 ENOTTY (Inappropriate ioctl for device)
    read(4, "[Support Model]\n\n0x0222,14,2,\"DC"..., 4096) = 642
    read(4, "", 4096)                      = 0
    close(4)                                = 0
    open("/opt/usr/local/Brother/sane/models3/ext2.ini", O_RDONLY) = 4
    ioctl(4, TIOCNXCL, 0x7fcb6a28)          = -1 ENOTTY (Inappropriate ioctl for device)
    read(4, "[Support Model]\n\n0x23e,14,2,\"DCP"..., 4096) = 86
    read(4, "", 4096)                      = 0
    close(4)                                = 0
    open("/opt/usr/local/Brother/sane/models3/ext3.ini", O_RDONLY) = 4
    ioctl(4, TIOCNXCL, 0x7fcb6a28)          = -1 ENOTTY (Inappropriate ioctl for device)
    read(4, "[Support Model]\n0x01c9,  17,2,\"D"..., 4096) = 251
    read(4, "", 4096)                      = 0
    close(4)                                = 0
    open("/opt/usr/local/Brother/sane/models3/ext4.ini", O_RDONLY) = 4
    ioctl(4, TIOCNXCL, 0x7fcb6a28)          = -1 ENOTTY (Inappropriate ioctl for device)
    read(4, "[Support Model]\n\n0x0257,13,2,\"DC"..., 4096) = 138
    read(4, "", 4096)                      = 0
    close(4)                                = 0
    open("/opt/usr/local/Brother/sane/models3/ext5.ini", O_RDONLY) = 4
    ioctl(4, TIOCNXCL, 0x7fcb6a28)          = -1 ENOTTY (Inappropriate ioctl for device)
    read(4, "[Support Model]\n\n0x0258,13,2,\"DC"..., 4096) = 469
    read(4, "", 4096)                      = 0
    close(4)                                = 0
    open("/opt/usr/local/Brother/sane/models3/Brsane3.ini", O_RDONLY) = 4
    ioctl(4, TIOCNXCL, 0x7fcb6a28)          = -1 ENOTTY (Inappropriate ioctl for device)
    read(4, "[Support Model]\n\n\n0x0206,14,2,\"D"..., 4096) = 1165
    close(4)                                = 0
    getdents(3, /* 0 entries */, 984)      = 0
    close(3)                                = 0
    open("/opt/usr/local/Brother/sane/Brsane3.ini", O_RDONLY) = 3
    ioctl(3, TIOCNXCL, 0x7fcb6a28)          = -1 ENOTTY (Inappropriate ioctl for device)
    read(3, "[Support Model]\n\n\n0x0206,14,2,\"D"..., 4096) = 1165
    close(3)                                = 0
    open("/opt/usr/local/Brother/sane/Brsane3.ini", O_RDONLY) = 3
    ioctl(3, TIOCNXCL, 0x7fcb70c8)          = -1 ENOTTY (Inappropriate ioctl for device)
    read(3, "[Support Model]\n\n\n0x0206,14,2,\"D"..., 4096) = 1165
    --- SIGSEGV (Segmentation fault) @ 0 (0) ---
    +++ killed by SIGSEGV +++
    
    It is really hard to tell why it is crapping out here... Any suggestions?
     
  15. rhester72

    rhester72 Network Guru Member

    Unless there's a bug in the code (and there may well be - it makes a LOT of assumptions), the only other thing I can think of (which isn't borne out by your strace) is maybe bad line endings in Brsane3.ini (i.e. DOS CR/LF), since the code is heavily dependent on them being Unix-style?

    Beyond that, honestly, the notion of actively debugging Brother's source code doesn't necessarily excite me. :) The good news, however, is that you can see the script (tomato-brscan3 and supporting scripts like tomato-include) and patch file I used to do the build, so once you get the Tomato-custom Linksys SDK up and running (the githead for the rt branch is fine), you should have all you need to do your own build and insert whatever debugging code might be helpful.

    Very interested in hearing how you make out,

    Rodney
     
  16. rhester72

    rhester72 Network Guru Member

    BTW - if it's line endings, you're dying in get_model_structure(). If it's something in the file itself (i.e. bad/garbage data, maybe try stripping out all but the info for your model?), it's failing in parse_and_add_model_info(). Both are fucntions of brother_advini.c.

    Rodney
     
  17. rhester72

    rhester72 Network Guru Member

    I just can't seem to let this go. *laughs*

    Ultimately, you will hit the wall.

    brother3.c:
    Code:
      rc = LoadScanDecDll( this );
      if ( !rc )  // Scan Decode DLL
          return SANE_STATUS_INVAL;
    
    brother_scanner.c:
    Code:
    #if      BRSANESUFFIX == 3
    static char  szScanDecDl[] = "libbrscandec3.so";
    ...
    
    BOOL
    LoadScanDecDll( Brother_Scanner *this )
    {
            BOOL  bResult = TRUE;
            this->scanDec.hScanDec = dlopen ( szScanDecDl, RTLD_LAZY );
    
            if( this->scanDec.hScanDec != NULL ){
    ...
            }else{
    ...
                  bResult = FALSE;
            }
            return bResult;
    }
    
    Your progress is currently a few hundred lines of C code from this wall. ;)

    Rodney
     
  18. theminor

    theminor Networkin' Nut Member

    Thanks a ton for all the help - I think getting the Linksys SDK up and running is a good next step, although I am also not super excited about debugging the source code either! I'll probably continue to poke around with it, so we'll see and I'll certainly post if I make any more progress.

    Thanks again, I really appreciate it

    EDIT - your last post got in while I was typing the above - it sounds like, in addition to the wall I've already hit, there is a major wall coming up! Stupid Brother - why keep part of the source closed and open part of it? I suppose that is why it is not included in the defualt sane libraries anyway... Maybe I can convince brother to compile it for me (riiiiighhhhtt.....)
     
  19. theminor

    theminor Networkin' Nut Member

    I know this is a stupid question, but I'll ask anyway - there isn't some sort of software like alien that converts dpkg or rpm to ipkg is there? Given the architecture of embedded devices, I highly doubt it, but just thought I'd throw this out there...
     
  20. rhester72

    rhester72 Network Guru Member

    They consider whatever low-level bits they fiddle to be confidential and proprietary (i.e. presumably if you knew their SCSI-over-USB protocol you'd be able to build a clone and put them right out of business *cough*bullshit*cough*), and that's precisely why it doesn't ship with SANE. Per one of the earlier URLs I posted, the German division of Brother actually _did_ attempt to get it open-sourced and ultimately met with failure (i.e. they actually got an answer, and it wasn't no, it was *NO!*).

    Sorry. I did read some Amiga guys reverse-engineered their own, but that's miles further away than where we're at now.

    Rodney
     
  21. rhester72

    rhester72 Network Guru Member

    I'm not aware of such a converter, no. ipkg is pretty obscure, all things considered.

    Rodney
     

Share This Page