Showing posts with label scanning. Show all posts
Showing posts with label scanning. Show all posts

Tuesday, February 21, 2023

some estate items - scanning concepts

Along with my father's ashes, a few boxes of family estate items arrived: clothing articles, wristwatches, analog cameras (see below), and many photos. Results? Dry-cleaning, leather restoration, protectants, watch repair, clothing alterations, and scanning. There was plenty of the lattter. Through the process, I learned that analog cameras remain useful in 2023, if a person can scan their negatives. If going this route, a person will also want to rent additional space on GDrive or buy some PCloud, probably 100G is sufficient.

scanning

A reliable, disposable document scanner reduces wear on a more expensive photo scanner, which can be used strictly for photos and slides. My two scanners, an Epson V30 and V600, had software drivers (from the AUR) that did not conflict with each other. Some ppl have scanners with drivers that conflict with other scanner drivers and will have to spend time sorting-out their software scenario.

Documents: A refurbed Epson V30 ($60). Replace now and then in order to save scanning mileage on the photo scanner. Some light vertical lines are inevitable. I run Linux; here's my software setup for the drivers.

  • if conflicts, remove other scanning drivers: eg, I had previously borrowed (see earlier post) a friend's HP MFP M424dw for which I had installed hpoj drivers from the AUR. All that HP sh*t had to be removed to avoid driver conflicts # pacman -Rsn hpoj
  • Documents - Perfection V30 (13.5 VDC) : uses the AUR iscan-plugin-gt-f720. Installs without issue.
  • Photos - Perfection V370 Photo (13.5 VDC): I also tried this scanner, since I had it laying around. I ultimately went back to a V30 for documents, but here's what I did. The AUR iscan-plugin-perfection-v370 driver is correct, but has an outdated SHA256 signature,and wouldn't install easily. A person can modify the ~/.cache/yay/iscan/iscan-plugin-perfection-v370/PKGBUILD file with the correct hash, avaliable in this page however, YAY simply downloads the latest file and overwrites the PKGBUILD modifications which again cause it to fail.
    1. attempt to $ yay iscan-plugin-perfection-v370, since the problem might now have been fixed.
    2. If it still throws the validity check fail and exits, rerun with the following flags (courtesy this page):
      $ yay -S --mflags --skipinteg iscan-plugin-perfection-v370
  • Bag: The V600 is 5.5" tall due to its two-sided lighting necessary for slides and negatives. So overall V600 is 19" x 11.5" x 5.5". The V30 is slim; 17" x 11.5" x 2". Properly padded bags are laptop size (too small) or camera gear size (too big). So we're looking at an improvised solution which will work for carrying the scanners in a car, but will not work for airline baggage check through without extensive bubble wrapping and all that BS. But still great for convenience carrying. The LL Bean Scotchlight bag is long enough, as is the Samsonite Profile model -- both tend to be expensively near $50. I found a "Protege Collapsible" sports duffel on Wal-Mart for $15. This requires rubber or bubble wrap afterwards. Ultimately I bought a Samsonite Profile used on EBay. Both scanners and their cords fit into the Samsonite Profile.

Photos: spend the money ($300) to reach a new V600.

  • Perfection V600 (24 VDC): uses the AUR iscan-plugin-gt-x820. Installs without issue.

If money's no object, get the V700. The 700 will do anything professionals need, but both have cleanable sensors; indispensable for photo/slide scanninig. This is because streaks eventually appear on any scanner, requiring sensor cleaning. On the V600 or 700, this is accessible. On less expensive versions, it's not. For example, I worked for days (disassembly, air blowing, etc) on an inexpensive "370 Photo", and never was able to rid it of streaks; I couldn't access the sensors in the consolidated scan heads. I eventually borrowed a friend's (expensive) HP MFP M426fdw (also CCD) to do photos until the V600 arrived. V600 = 19" x 11.5" x 5.5". Fits

For slides and negatives (obviates keeping photos), a specialized tray is included in the V600 and 700 - see above. To get the focus correct, the tray has focus tabs. Focus can be tweaked further using, eg, Bostik Blue Tack putty, to raise and lower slightly until perfect. See the video below from erwnalejo. My tray does 4 slides at once, and I scan at 800x800 which gives excellent results for prints (2.2Mb file / 4 pics about 550K each). For less important, but still good for archive and online, I use 400x400, providing about 1.1Mb file and about 260K per photo.

Wal-Mart: Loctite Fun-Tak pads. 2oz, $2.17. (less expensive than Bostik) EBay: Squeeze bulb dusters. $6!ea. (no chance of freezing like canned air)

remove color lines (1:14) Duncan Dimanche, 2021. V600/700 cleanable sensor locations.
V600 scanning tips (5:53) erwnalejo, 2021. Somewhere in Western Kansas. Lomo digitaliza, blue tack to adjust height. Links in comments to products. Lomo is an extra $50.
epson scanning tips (28:11) Nick Carver, 2019. Paper masks some of the holder. 5:40 uses a squeeze ball. 2400 dpi is fine for any normal use including 8.5 x 11 blowups, etc.
V600 overview (52:17) Film Friends, 2022. Comprehensive.

negatives (cont)

A few added negatives notes, since we need to address, 1) what resolution, 2) how to make postives.

First, there are obviously multiple images every scan, unlike the one-at-a-time method of photos and documents. And obviously a person must shift to the Transparency Unit from Flatbed (at least in Xsane). I do slides and negatives at 800x800 resolution, fine for archiving.

Secondly, I use GIMP2 for post-processing. A person can do GEGL Negative Darkroom (under Tools) and apparently achieve some good effects, but I have faster processing with some presets in the color curve. Eventually, a script is the way to go, but I don't have the free time currently. Script would do some version of what I do manually: A) Rotate the strip. B) Colors -> Invert (this result in a kind of bluish image). C) Run my presets in the Color curve. Here's a color slide from 1955.

GIMP: negative to positive (1:20) wilwad, 2022.
GIMP: Gegl darkroom (11:53) JonnyRobbie, 2021.

items

Old SLR's aren't worth much on the market. They're inexpensive to duplicate, so why carry these old ones around. For me, "a way to honor/remember my parents by repeating some of their activities." When I look at my wrist, my Dad's old watch dispays time in the same way it did when he looked at it. The old camera allows me to consider shots with the same pleasures and limitations he encountered. Pleasurable.

1. Olympus OM-1 MD (1977)

The OM-1 (including OM-1 MD) is a 35mm SLR which began the OM series. Battery (open with a penny, for models, see here and scroll down), on/off switch. SN 1325151 seems to be from 1977, but could be as early as 1974 or as late as 1979. It also seems to be without prism foam. However, another post, indicates prism foam must always be investigated.

Since it is the "MD" (motor-drive) version, it has a 5fps auto-drive or a single shot auto-winder. It has the black and yellow film-speed dial. As noted above in the above battery link, battery replacement is complex in 2023. One fellow hacked it. Note that there are two penny releaseable openings on the bottom. The larger one is for the battery (light-meter), the smaller one is the opening to connect the external motor drive.

light seal replacement (18:42) Li Reviews, 2022. Old light seals ruin film.
attach/remove ft lens (2:46) Caleb Ginsburg, 2021. Turn to f5.6, then turn speed selector to 400 ASA in alignment with 5.6, then push the release button. It sort of hinges from top to bottom.

leather case

Has two ears on the front which hold the camera in the case. These must be maintained to prevent cracking. Repeated soaks (remove from water just prior to any slime-ing),to get out salts then mink oil. I tried some Fiebing Mink Oil paste (6 oz, $8.29) instead of the desired Saphir.

restore old boots (23:00) Trenton and Heath, 2022. Remove from water before slime, each soak session. First 3:11 describe the soaking, and then at 19:33, the Saphir Medaille d'Or mink oil ($20)
leather satchel restore (19:19) James Berry, 2021. Saddle soap not soak to get off grime b/c too large to soak. Then Saphir.
gluing leather (13:06) Weaver Leather Supply, 2020. Avoid any water-based glues since, obviously, these reactivate with moisture. S-18 glue, contact cement and glue thinner. Another video describes Tanner's Bond and EcoWeld (same chemical).

2. Nikkormat FT (1965)

Does have a battery. In one box however was a Nikon Nikkormat FT camera, SN 4159963, probably from 1965. This is a mechanical/analog Single Lens Reflex (SLR) camera, using a prism and a mirror, he apparently bought when he was about 23 years old. He saw the world through this camera, and once I learned more about scanning negatives, I took an interest. My original thought was just to harvest the lenses for possible DSLR use.

how to load Nikkormat film (2:02) Dennis Workman, 2022. A hidden tab at the bottom of the left side. Pull down. Shutter release right next to winder.
attach/remove ft lens (2:46) Caleb Ginsburg, 2021. Turn to f5.6, then turn speed selector to 400 ASA in alignment with 5.6, then push the release button. It sort of hinges from top to bottom.

leather case

Same as with Olympus above.

3. Seiko Automatic SKX781 (2004)

In the $500 range on E-Bay, depending on the band and the condition. Nicknamed the "orange monster", of course. Self-winding, 3 position bezel: all the way out for time, middle in two directions for date or day of week. Screws down to water seal when complete.

Sunday, February 12, 2023

install -- HP Laserjet Pro MFP M426fdw (03f0:5a2a)

Continuing to look to scan without lines. My CCD Epsons (V30, V370) both have faint vertical lines -- still great for documents, but unacceptable for photos. Buddy let me use this HP MFD, since its printer doesn't work anymore and that's all he used it for. All I need are scan functions. 2007 vintage. Unfortunately MFD HP's require installing the entire HP print kludge (CUPS and HPLIP) just to use the scanner.

hardware

Standard USB scanner cable and power cord.

$ lsusb 03f0:5a2a HP, Inc HP LaserJet MFP M426fdw

software - driver

I took out the V370 software to prevent conflicts and put in the HP bloatware.

# pacman -Rsn iscan-plugin-perfection-v370
Packages (4) iscan-2.30.4.2-3 iscan-data-1.39.2.1-1 libstdc++5-3.3.6-9 iscan-plugin-perfection-v370-2.30.4-1

Total Removed Size: 2.75 MiB
$ yay -Ss hp printer
aur/hpoj 0.91-21 (+91 0.00) (Out-of-date: 2020-07-28)
Hewlett-Packard OfficeJet, PSC, LaserJet, and PhotoSmart printer multi-function peripherals (MFPs) drivers
$ yay -S hpoj
Packages (13) foomatic-db-engine-4:20220521-1 hplip-1:3.22.10-3 perl-alien-build-2.77-1
perl-alien-libxml2-0.19-1 perl-capture-tiny-0.48-6 perl-dbi-1.643-4
perl-ffi-checklib-0.31-2 perl-file-chdir-0.1011-4 perl-path-tiny-0.144-1
perl-xml-libxml-2.0208-1 perl-xml-namespacesupport-1.12-5 perl-xml-sax-1.02-1
perl-xml-sax-base-1.09-5

Total Download Size: 22.82 MiB
Total Installed Size: 38.80 MiB

software - printer

Use whatever lsusb provides, in this case 1 and 4. It should install with some Qt5 errors. This AUR version still runs on Qt5, when Qt6 is the current release.

$ hp-setup -i --auto 001:004
error: No module named 'PyQt5.QtCore'
error: Unable to load Qt4/Qt5 support. Is it installed?

error: No module named 'PyQt5.QtWidgets'
# pacman -S python-pyqt5

software - proprietary

1) uninstall the printer and fax using lpadmin (lookup its name in CUPS). 2) reinstall it again using hp-setup. This should work b/c you've now got all the Qt in place. After hp-setup, then 3) click the HP prompt to download their proprietary scanning file.

# lpadmin -x HP_LaserJet_MFP_M426fdw
# lpadmin -x HP_LaserJet_MFP_M426fdw_fax
$ hp-setup -i --auto 001:004
It's possible we can get a list of the files at Alternatively go HP website, which will auto-detect the OS from the browser of course. SMH. Anyway, just select the model, in this case

...which will simply bounce to the HPLIP. This is their goal. And now they don't have HPLIP in the form of an unzippable file. Now its a script that has to download the file itself. Data gathering, see?

software - proprietary plugin

The first scan activation (eg with xsane), HP's national security features arise. There is no way to anonymously scan. HP downloads a proprietary file, otherwise the scanner will not operate. A watermark unavailable to the naked eye will be added to all scans and the installer does not reveal where it installed on the system. There's no getting around it, but this is how to navigate it, hopefully without breaking your pacman index, like any 3rd party installer will. It does not say where these files are.

...and then choose the option here.

Thursday, April 20, 2017

[solved] Epson V30 (04b8:0131) v. V370 (04b8:0141a)

nb: 2022 - subbed "yay" for all "yaourt"

short version

Neither scanner will be detected in $ scanimage -L unless correct driver is used. Typically the V30 works well with only the driver, whereas the V370 needs the driver and may also need "epowka" adjustments described further down this page. Neither scanner requires CUPS.

V30 (04b8:0131) - $ yay -S iscan-plugin-gt-f720

V370 (04b8:014a) - $ yay -S iscan-plugin-perfection-v370

If still no proper V370 detection, check the "epowka" and "hpaio" notes further down. I've never been able to configure a box for both scanners so I could hook up either. I remove the driver for the scanner not being used.


prevention

  • check the connection
    $ lsusb
    ID 04b8:0131 Seiko Epson Corp. GT-F720 [GT-S620/Perfection V30/V300 Photo]
  • install and enable cups
    # pacman -S cups
    # systemctl list-unit-files |grep cups
    [if necesary....]
    # systemctl enable cups.service
    # systemctl restart cups.service
  • can play with turning cups on and off or even uninstalling it later, but it's likely to be initially necessary for the scanner to successfully build against
  • install the AUR driver
    $ yay -S iscan-plugin-gt-f720
  • verify it's a detected scanner
    $ scanimage -L
    device `epkowa:interpreter:001:006' is a Epson Perfection V30 flatbed scanner
  • try a test scan with, e.g. xsane

problem

Initiating the GUI xsane application with a USB-connected Epson V30 scanner results in a pause, then termination of the xsane application (without scanning). Connecting an Epson V370, the same actions result in normal xsane scanning operations. Using a known-good, functioning USB-connected Epson V370, let's run similar applications on both the V370 and the non-functioning V30, until we can find a difference, and hopefully solve the V30 non-operation.



CLI software

First, can we at least detect the V30 using the command-line? Two command line interface (CLI) scanner probes, scanimage and sane-find-scanner, verify slightly different features. Scanimage is the more thorough. Scanimage on the V30 pauses, but eventually goes to completion, describing the V30 as "unknown model".
$ scanimage -L
device `epkowa:usb:001:004' is a Epson (unknown model) flatbed scanner
... on the V370 there's no delay and the model name is identified.
$ scanimage -L
device `epkowa:interpreter:001:004' is a Epson Perfection V370 Photo flatbed scanner
Model name aside, the V30 and V370 are properly detected and trigger the kernel to create data files; we can rule-out hardware, firmware, or kernel problems. Since the USB device name for the V370 includes "interpreter", but the V30 device name remains "usb"; the kernel is not receiving additional information for the V30, beyond the simple usb connection. Let's locate the (operational) V370 driver on the hard drive, and see if the V30 is in the same folder and perhaps not working.
Attaching the USB V370, and stracing $ scanimage -T ($ strace scanimage -T 2>&1 |tee V370file.txt) and then searching inside the resulting text file, I noted (~line 1195)
open("/usr/lib/iscan/libiscan-plugin-perfection-v370.la", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/iscan/libiscan-plugin-perfection-v370.so", O_RDONLY|O_CLOEXEC) = 9
The V370 driver inside /usr/lib/iscan, however I could find no driver relevant to the V30 in that folder. It appears we're lacking a V30 driver. A V30 driver would give the kernel more information than "usb".

driver software

I lucked into a premade AUR version of the V30 driver -- one step with yaourt. A conversation about this driver exists on the forums. Apparently, the creator downloaded a DEB file from the Epson site and then converted the DEB into a pacman/yaourt package. It's probably also worth noting that DEB's can be directly installed on Arch with a couple of steps. In this case, I had the premade AUR version I could install more easily using yaourt.
$ yaourt Ss v30
aur/iscan-plugin-gt-f720 0.1.1-1 (8) (0.01)
EPSON Image Scan! plugin for Epson Perfection V30 scanner
$ yaourt -S iscan-plugin-gt-f720
After installation, the V30 should appear with its model information and "interpreter" instead of "usb"...
$ scanimage -L
device `epkowa:interpreter:001:004' is a Epson Perfection V30 flatbed scanner
...and scan images via xsane.

possible tweaks

If there are still problems, check the following.
  • Uncomment "usb" inside /etc/sane.d/epowka.conf, but without adding any make or model information, just leave it as "usb". If you add make or model, scanimage may generate a second, conflicting, instance of the V30.
  • Comment "epowka" in /etc/sane.d/dll.conf, or conflicts will occur.
  • The scanner libs directory should include softlinks to the main lib, libesci-interpreter-gt-f720.so, eg
    $ ls /usr/lib/iscan/
    libesci-interpreter-gt-f720.so
    libesci-interpreter-gt-f720.so.0
    libesci-interpreter-gt-f720.so.0.0.0
  • Run
    $ iscan-registry -a 0x04b8 0x0131 libesci-interpreter-gt-f720.so
See bottom of this page for more configuration file info.

Troubleshooting prior to yaourt

block hpaio

Sometimes hpaio loads when there's no HP scanner. Like many Linux apps, they either don't work at all or they can never be disabled. Hpaio won't stop the V30 or other scanners, but it's a hardcore annoyance since it's impossible to turn off via any interface, by disabling CUPS, etc. I got tired of this fast and blacklisted the sumb*tch. Find the names of the hp-related libsane files in /lib/sane.d/, because you can't find it and its dependencies the normal way...
# modinfo -F depends libsane-hp
modinfo: ERROR: Module libsane-hp not found.
... and then blacklist them via /etc/modprobe.d/blacklisted.conf (you can call the file anything).
# nano /etc/modprobe.d/blacklisted.conf
# stop hpaio annoyance when no hp scanner connected
install libsane-hpaio /bin/true
install libsane-hp /bin/true

xsane also loads hpaio

Any time xsane is initiated, xsane finds these hpaio drivers and loads them directly. Stracing xsane
open("./dll.d", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/etc/sane.d/dll.d", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 7
fstat64(7, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getdents(7, /* 4 entries */, 32768) = 76
1572:stat64("/etc/sane.d/dll.d/hpaio", {st_mode=S_IFREG|0644, st_size=6, ...}) = 0
1573:open("./dll.d/hpaio", O_RDONLY) = -1 ENOENT (No such file or directory)
1574:open("/etc/sane.d/dll.d/hpaio", O_RDONLY) = 8
1576:read(8, "hpaio\n", 4096) = 6
4071:open("/usr/lib/sane/libsane-hpaio.so.1", O_RDONLY) = 19
4073:open("/usr/lib/sane/libsane-hpaio.so.1", O_RDONLY|O_CLOEXEC) = 19
so you will also have to disable xsane from activating hpaio.
# nano /etc/sane.d/dll.d/hpaio
# comment the following so hpaio doesn't load.
#hpaio
Note: don't forget that, if an HP scanner is ever connected, you'll need to undo these changes to both /etc/sane.d/dll.d/hpaio and to /etc/modprobe.d/blacklisted.conf.
But back to yaourt. Yaourt was the end-point, yet I had proceeded through several troubleshooting steps to determine the driver issue. A couple of workday's worth of effort were spent ruling-out any physical connection, firmware, kernel, or configuration files. Some of that is noted above, the remainder is below.

lsub -vv (v370)

Partial information from lsusb -vv:
idVendor 0x04b8 Seiko Epson Corp.
idProduct 0x014a
bcdDevice 1.00
iManufacturer 1 EPSON
iProduct 2 EPSON Perfection V37/V370
iSerial 0

lsub -vv (v30)

Partial information from lsusb -vv
idVendor 0x04b8 Seiko Epson Corp.
idProduct 0x0131 GT-F720 [GT-S620/Perfection V30/V300 Photo]
bcdDevice 1.00
iManufacturer 1 EPSON
iProduct 2 EPSON Scanner
iSerial 0

sane-find-scanner

Running sane-find-scanner (lsusb -vv also would have been fine) against both models, both scanners properly return hexadecimal model/product codes.
(vendor=0x04b8 [EPSON], product=0x014a [EPSON Perfection V37/V370])
... and for the V30, sane-find-scanner returns...
(vendor=0x04b8 [EPSON], product=0x0131 [EPSON Scanner])
I also attempted to get attributes and do tests on the V30, prior to yaourt.
$ scanimage -A -d 'epkowa:usb:001:004'
$ scanimage -T -d 'epkowa:usb:001:005'
Both of these time-out, returning nothing however, since we have the hexidecimal model code on both scanners (0131 for the V30 and 014a for the V370), firmware, hardware detection, and/or physical USB connection problems are ruled-out. There are three remaining categories of variables for this V30 problem. 1) Kernel software, application software, configuration files.

Kernel side

The kernel creates and destroys files inside the directory /run/udev/data/ whenever a USB device is connected or disconnected to a UNIX system. User-level applications, such as xsane, then read these files for operating parameters. So we'd like to check the /run/udev/data/ files for the V30. If they're good, we know xsane is malfunctioning. If they're bad, we know the kernel is malfunctioning (or not receiving enough V30 info).

/run/udev/data

How do we find the names of the files created when the V370 or the V30 are connected by USB? Sane-find-scanner is helpful, but we'll need to strace it to gather enough information. We'll send the two results to text files we can parse. First, the operating scanner, V370. Connect it to the USB port and, ($ strace sane-find-scanner 2>&1 |tee V370file.txt). At line 700 (YMMV) of V370file.txt, we find a call to the data file c189:5:
$ grep -rn "/run/udev/data"
open("/run/udev/data/c189:5", O_RDONLY|O_CLOEXEC) = 8
Next, the non-scanning V30. Connect it via USB and, $ strace sane-find-scanner 2>&1 |tee V30file.txt . At line 700 (again, YMMV) of V370file.txt, we find a call to the data file c189:4:
$ grep -rn "/run/udev/data"
open("/run/udev/data/c189:4", O_RDONLY|O_CLOEXEC) = 8
Now we have the names of the two data files the kernel creates, 189:5 for the V370, and 189:4 for the V30. Here's the content for the two files. The (functioning) V370
$ cat /run/udev/data/c189:5
I:97119577141
E:ID_VENDOR=EPSON
E:ID_VENDOR_ENC=EPSON
E:ID_VENDOR_ID=04b8
E:ID_MODEL=EPSON_Perfection_V37_V370
E:ID_MODEL_ENC=EPSON\x20Perfection\x20V37\x2fV370
E:ID_MODEL_ID=014a
E:ID_REVISION=0100
E:ID_SERIAL=EPSON_EPSON_Perfection_V37_V370
E:ID_BUS=usb
E:ID_USB_INTERFACES=:ffffff:
E:libsane_matched=yes
E:ID_VENDOR_FROM_DATABASE=Seiko Epson Corp.
E:ID_PATH=pci-0000:00:12.2-usb-0:2
E:ID_PATH_TAG=pci-0000_00_12_2-usb-0_2
E:ID_FOR_SEAT=usb-pci-0000_00_12_2-usb-0_2
G:uaccess
G:seat
...and, when the V30 is attached
$ cat /run/udev/data/c189:4
I:138131813751
E:ID_VENDOR=EPSON
E:ID_VENDOR_ENC=EPSON
E:ID_VENDOR_ID=04b8
E:ID_MODEL=EPSON_Scanner
E:ID_MODEL_ENC=EPSON\x20Scanner
E:ID_MODEL_ID=0131
E:ID_REVISION=0100
E:ID_SERIAL=EPSON_EPSON_Scanner
E:ID_BUS=usb
E:ID_USB_INTERFACES=:ffffff:
E:libsane_matched=yes
E:ID_VENDOR_FROM_DATABASE=Seiko Epson Corp.
E:ID_MODEL_FROM_DATABASE=GT-F720 [GT-S620/Perfection V30/V300 Photo]
E:ID_PATH=pci-0000:00:12.2-usb-0:2
E:ID_PATH_TAG=pci-0000_00_12_2-usb-0_2
E:ID_FOR_SEAT=usb-pci-0000_00_12_2-usb-0_2
G:uaccess
G:seat
Since both the V370 and the V30 files are properly created inside /run/udev/data/, the kernel is now ruled-out as a problem. Secondly, these presence of these data files also probably excludes the rules the kernel uses to write data files for /run/udev/data/. These rules for helping the kernel translate a physical USB connection into a data file are in /lib/udev/rules.d/. In the case of the scanner rules, the rules file is /lib/udev/rules.d/49-sane.rules. So far, everything has checked-out normally, and now we have ruled out the kernel's USB firmware detection and data propagation processes.

Unsolved

Our current unsolved clues related to the non-scanning are 1) the pause and eventual time-out when V30 is queried, 2) the unnamed model "Scanner", 3) the name "usb", instead of "interpreter" inside scanimage -L results.
# echo -1 >/sys/module/usbcore/parameters/autosuspend
Still, EAGAINs and the pauses did not stop, and this led me, finally, to a driver.

Other rule-outs: configuration files

  • /etc/sane.d/epson.conf - possibly could add the make and model to identify the V30, however if a yaourt or pacman solution is available, remove it.
  • /etc/sane.d/saned.conf - Should not be a problem, since V370 is operating
  • /etc/sane.d/dll.conf - No problems since V370 is working
  • /etc/sane.d/epkowa.conf - No problems since V370 operates
  • /usr/share/iscan-data/usb - Neither the 014a or the 0131 models are in this file. This file is opened during scanimage tests however.

Sunday, June 21, 2015

[solved] xsane detection of older or all-in-one HP printers

Sometimes you've got an old HP printer missing print heads or some such, but you still want to use it for scanning. Not all printers can be directly accessed using scanning software, such as SANE, unless the entire printer has been installed using printer software "drivers" (in Windows terms). This is often the case with HP's. To install HP printers, the standard "driver" package is HPLIP. HPLIP is available on Arch repos, however the Arch version of HPLIP doesn't include the specialized PPD's necessary for the printer. (See Section 3 below).

A recent encounter with a broken old HP OfficeJetPro L7590 was a case in point. I only needed this printer to scan. I turned the printer on, and connected the USB. My box detected the USB connection, but /etc/sane.d/dll.conf could not be modified for SANE to successfully communicate with the HP. The standard symptom of this existed: $ sane-find-scanner located the printer, but $ scanimage -L did not. So, good connection, but no scanning: I would have to install the printer driver. Here are the steps.

1. SANE

As just noted above, SANE was properly installed. That was simply:
# pacman -S xsane
Xsane pulls-in SANE software as dependencies, so no need to separately install SANE.

2. HPLIP

As also noted above, after we'd had SANE in, we'd connected everything (USB cable to scanner, powered on scanner) and attempted $ sane-find-scanner. This detected the printer, but $ scanimage -L did not. Since we were dealing with an HP, we needed the HP Linux printer driver set, HPLIP.
# pacman -S hplip

3. PPD

As noted at the outset, the Arch version of HPLIP does not include PPD's. PPD's are information files specific to each printer model. Both CUPS and HPLIP rely on them. Since the Arch version of HPLIP does not include them, the attempt to install an HP printer ($ hp-install -i) fails at the PPD step. Where to get the PPD for HP printers?

Go to the HP support website and download the tarball of the full version of HPLIP. Uncompress it. Enter the uncompressed folder and locate the "ppd" folder. Find the PPD for your model. After you unzip that PPD, put it anywhere you can easily remember, say your home folder. Now you are ready to complete the HPLIP printer driver installation.

4. Finally


Run $ sane-find-scanner again, and write down the USB number. In this case, let's say it was "002:003". Then we simply run...
$ hp-install -i 002:003
...and follow its prompts. At some point, the HP install dialog will prompt you for a path to the PPD. Provide the path to wherever you put it, eg. "/home/foo/hp_l500.ppd". The installation of the printer will finish normally1.

After HPLIP and the proper PPD are present, and the scanner is connected, our last test is to $ scanimage -L . We should see the scanner:
$ scanimage -L
device `hpaio:/usb/Officejet_Pro_L7500?serial=MT97K251CP' is a Hewlett-Packard Officejet_Pro_L7500 all-in-one
Now we can fire-up Xsane and scan.

1 If also needing to print with this printer, do a customary CUPS printer installation (after doing the steps above). Assuming the CUPS daemon is already running and permissions are correct, access the CUPS'administrative page at http://localhost:631 and add the printer to CUPS.

Friday, January 2, 2015

[solved] xsane fails to find WLAN Brother scanner

Over the holiday I visited a buddy who put me on his home WLAN, which included a Brother MFC-8840D printer. This printer also has scanning capacity. I added the printer via CUPS, and it printed. I hadn't network scanned previously, so I tried Xsane, hoping for the best. Xsane failed to detect the MFC-8840D. I was skeptical about going straight to port 6566, since forwarding runs the risk of compromising the firewall or causing other security problems, which are easy to do, apparently. So, what to do? Below, I'll describe my solution, and then some of the troubleshooting (6+ hours) that preceded it.

1. overview

Budget a half-hour to forty minutes to accomplish the connection if you already know the steps. Some of my learning steps: 1) SANE and CUPS are entirely different pathways; SANE does not require CUPS to be operating or enabled during scanning, at least on a Brother, 2) determine the correct backend software for your scanner and download (if necessary), 3) if using brscan-skey for special buttons (see below) start the necessary daemons with systemctl. I didn't need brscan-skey however, had I needed it, this step is important, 4) manually install the config file (after backend).

2. scanner backend

This took getting used to. USB scanners typically don't require drivers in Linux so for this WLAN scanner, I was thinking all the scanner would need was a network connection. Over a network, a driver is also needed. Brother has a site for LAN backends. Go there to determine which version you need for your Brother model. There two files:
  • backend - for the older printer my buddy had it was "brscan". In the AUR, it says it's for USB scanners, but that's a misleading typo. Just download and install.
  • scan key - pointless unless you want to use automated physical keys on the scanner such as "scan to fax", "scan to email", etc. Secondly, if you obtained "brscan" in step 1 above from the AUR, then scan-key is included and you don't need this step anyway.
Note: For those who want brscan-skey, documentation shows it's good to omit the "user" and "group" fields, and install the service file to /usr/lib/systemd/user/brscan-skey.service instead of /usr/lib/systemd/system/brscan-skey.service. That's so users can start (or enable) the brscan-skeydaemon as a regular user without sudo, eg:
$ systemctl --user start brscan-skey
If you don't do all those permission changes, you apparently will need the standard:
# systemctl start brscan-skey.service
As noted above, I didn't need brscan-skey, so I disabled it (I also stopped CUPS).

3. install the config file

The following application is supposed to do the installation:
# /usr/share/brother/sane/setupSaneScan -i
This didn't work for me. In other words, after this step, I looked for the scanner and was greeted with the following:
$ scanimage -L
bugchk_free(ptr=(nil))@brother_modelinf.c(467)
Aborted (core dumped)

Strace indicated scanimage failed when looking for "Brother.ini" at /usr/local/Brother/sane/Brsane.ini. The file does exist however, at /usr/share/brother/sane/Brsane.ini, so I created the directory in /usr/local , and copied the file to where it was looking.
# cp /usr/share/brother/sane/Brsane.ini /usr/local/Brother/sane/Brsane.ini
At this point, the program ran through but, as user, could not create a socket connection due to permissions (go figure).
$ scanimage -L
[bjnp] create_broadcast_socket: bind socket to local address failed - Cannot assign requested address
What's apparently happened here is setupSaneScan doesn't work very well. It might even be unnecessary to run. In my case, it certainly failed to write the file /usr/share/brother/sane/brsanenetdevice.cfg, or to install the scanner. This site has the few lines needed to nano into /usr/share/brother/sane/brsanenetdevice.cfg. For example:
# nano /usr/share/brother/sane/brsanenetdevice.cfg
DEVICE=MFC8840D , "MFC-8840D" , 0x4f9:0x160 , IP-ADDRESS=192.168.1.4

In summary:
  • copy /usr/share/brother/sane/Brsane.ini to /usr/local/Brother/sane/Brsane.ini
  • create and enter lines into /usr/share/brother/sane/brsanenetdevice.cfg

4. install the scanner driver

Following the hand-entries in /usr/share/brother/sane/brsanenetdevice.cfg, the printer/scanner still must be installed.
  • unless desired, turn off CUPS and brscan-skey with systemctl
    # systemctl stop org.cups.cupsd.service
    # systemctl stop brscan-skey.service
  • obtain the IP of the printer, you'll recognize it by its operating system
    # nmap -O 192.168.1.1/24 -oG
  • obtain the exact model name for the printer from /usr/share/brother/sane/Brsane.ini
  • let's say the printer IP was 192.168.1.4, and the model name was "MFC-8840D". Using these values, or the ones for your printer, enter /usr/share/brother/sane/brsaneconfig -a name="common name" model="model from INI" ip=xxx.xxx.xx.xx", eg,
    # /usr/share/brother/sane/brsaneconfig -a name=MFC8840D model=MFC-8840D ip=192.168.1.4
  • verify this went through with "brsaneconfig -q", and "scanimage -L"
# /usr/share/brother/sane/brsaneconfig -q
Devices on network 0 MFC8840D MFC-8840D I:192.168.1.4
$ scanimage -L
device `brother:net1;dev0' is a Brother MFC-8840D MFC8840D
So, with scanimage -L showing detection, xsane can be initiated for scanning.

investigation leading to solution (6+ hrs)

This is not necessary to read; it's just crib notes (to save time in the future) of troubleshooting which eventually led to a solution.

To start with, I left the CUPS daemon on. I wasn't sure what might be necessary to detect the scanner. Further down here, I realize CUPS actually gets in the way of installation. Secondly, I read that scanner drivers expect "nobody" should be included in the "scanner" group. You can do this with, eg...
# usermod -a -G scanner nobody
... but I like to directly (not recommended) type into the /etc/group and /etc/passwd files: I added nobody to the scanner group in /etc/group. None of these changes had any effect, but YMMV. I then checked for scanners.
$ scanimage -L
[bjnp] create_broadcast_socket: bind socket to local address failed - Cannot assign requested address
Since BJNP is the Canon-specific CUPS back-end, and since my attempt to connect was to a Brother, the unsolicited appearance of BJNP, and causing scanimage to repeatedly fail, was... annoying.

A more powerful attempt to locate the fail...
# strace scanimage -L 2>&1 |tee bigfile.txt
# chown 500:500 bigfile.txt
$ grep socket bigfile.txt >bigfile2.txt
And here's the portion with the fail...
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 132 setsockopt(132, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0 setsockopt(132, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0 bind(132, {sa_family=AF_INET6, sin6_port=htons(8612), inet_pton(AF_INET6, "fe80::b277:2173:31a6:e71", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=if_nametoindex("enp4s0")}, 28) = -1 EADDRNOTAVAIL (Cannot assign requested address) fstat(2, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 write(2, "[bjnp] ", 7[bjnp] ) = 7 write(2, "create_broadcast_socket: bind so"..., 95create_broadcast_socket: bind socket to local address failed - Cannot assign requested address ) = 95 close(132)
Subroutine 132 is failing. The real fail was scanimage was demanding an IPV6 addresses, which of course is a too rigid restriction to place onto an older IPV4 scanner. Additionally, scanimage was soliciting via "enp4s0", the ethernet LAN NIC. This was a further problem because the LAN NIC was not connected, I was only connecting via my WiFi card. If scanimage demanded these to be present, nothing was going to work on the older Brother on a WAN.

To be sure I wasn't crazy, I nmap-ped the LAN ("nmap -O 192.168.1.1/24 -oG somefile.txt") , found the printer by the Brother OS, and made sure I was able to ping it successfully, using only the WiFi NIC, and leaving the LAN NIC disconnected. This was a success. But I never was able to eliminate the BJNP, IPV6, or LAN NIC failures with the CUPS daemon "on".

/etc/sane.d/saned.conf

Digging through some pages, it appeared the first effort should be to modify /etc/sane.d/saned.conf When I opened the file, all lines were commented, so I added two uncommented lines
localhost 192.168.1.0/24

/etc/saned.d/net.conf

According to http://wiki.archlinux.org/index.php/sane, the file /etc/sane.d/net.conf must be similarly modified.
localhost 192.168.1.0/24

to xinetd or not xinetd?

Xinetd is for allowing anyone on a LAN to use a hardwired (eg. by USB) scanner. My friend's Brother was sitting on a WLAN, independent of any system, so it should have been simpler. Still, after I installed xinetd (pacman), some tweaks were required. For example, in /etc/sane.d/saned.conf,these lines are at the bottom:
# NOTE: /etc/inetd.conf (or /etc/xinetd.conf) and # /etc/services must also be properly configured to start...
Well now. /etc/services is a listing of applications for each port, and sane-port was there at line 6566 for both UDP and TCP. This appeared OK. Next stop was /etc/xinetd.d/sane.
# cat /etc/xinetd.d/sane service sane-port { port = 6566 socket_type = stream wait = no user = nobody group = scanner server = /usr/bin/saned # disabled by default! disable = yes }
So there's nothing allowing LAN access. Using the site above, and this Slackware page, I changed the file by adding "tcp" capability (because WLAN):
# cat /etc/xinetd.d/sane service sane-port { port = 6566 socket_type = stream protocol = tcp wait = no user = nobody group = scanner server = /usr/bin/saned # disabled by default! disable = no }

check loopback

If you went the nuclear route and brought down your firewall during this, a good check to be sure it's re-established is to telnet into it. The connection should be refused.
telnet localhost [service port]
For example, xsane uses port 6566 so...
telnet localhost 6566
Try telnetting as both root and user; if groups are properly set-up, users should be able to telnet the port.

Friday, August 8, 2014

[solved] yet another CUPS related failure -- interference with xsane.

We've all encountered the problem with Xsane where it fails to detect a properly attached USB scanner. Many times this is due to an error in permissions around the scanning group -- the scanner will only be detected as root. Here's a variant: a detection fail in both root or user modes due to CUPS. In my system, if CUPS is running, the scanner cannot be detected in user or root. No informative error message explaining this will be displayed.

There are many ways to determine if the CUPS daemon is running, most involving root. The fastest way is to remember "I just used the printer", but another way from user-space is:
$ lpstat
lpstat: Bad file descriptor
lpstat returns this message when CUPS is not running, and will return a blank line if CUPS is running.

Depending on one's distribution, disable CUPS with...
# systemctl stop cups
Once CUPS is deactivated, Xsane should again detect the scanner in user mode if permissions are properly set.

CUPS accesses stand-alone boxes through loopback privileges into localhost and the CUPS daemon runs under root. Looping-back has associated permission locks which apparently block USB detection, not sure. Anyway, turn CUPS off and scan normally.


Editorial: Since the majority of Linux users are stand-alone users with non-network printers, I consider it a conceit of CUPS developers not to have created a simple stand-alone variant which doesn't need the spaghetti or security issues of loopback privileges. When one considers that the CUPS code is 20 years mature, that its PPD's are actively updated by others, and that only a few lines of code are likely necessary to access USB ports, it becomes annoying. Currently, many CUPS installations require more manipulation of groups than most Linux users possess. More importantly are the security liabilities created by loopback access. Few advanced users, and probably no average users, possess the significant PAM, LDAP, port scrambling, ipchains, etc, knowledge to be certain they've closed less obvious loopback security holes. By the normal desire of Linux users to print, and the lack of any direct stand-alone solution, it's possible many of our systems are quietly compromised.

Tuesday, October 29, 2013

primefilm 7250u scanner - arch/fuduntu (05e3:0145)

Links: CLI scanning w/scanimage :: sane-config options :: extracting .nal from Windows driver :: deeper on the .nal

This is a c. 2013 Genesys/Pacific Image Electronics scanner -- oth

Relevant folders: 1) dev/bus/usb [device]; 2) etc/sane.d [daemon only]; 3) etc/udev/rules.d [custom rules]; 4) usr/lib/sane [backends]; 5) usr/lib/udev/rules.d [default rules]; 6) usr/share/sane


A friend recently purchased a Primefilm 7250u to scan old slides. Closed-source Windows and Mac software came with it. Difficulty: No software for Linux, not even Vue-Scan. Fuduntu has no access to repos. A kludge of interacting files, as one can see from the folders above.

The most important steps

The first two steps need to happen in order. We need to be sure, 1) the scanner is detected and, 2) the correct backend is called. For detection, /usr/lib/udev/rules.d/49-sane.rules, or (user-created) /etc/udev/rules.d/[custom].rules must contain the vendor ID. These files then call the correct backend(s).

hardware detection

Sane-find-scanner does not check the backend, it simply verifies the scanner is connected and that it's vendor ID is one of the rules files. This is hardware detection, pure and simple. Scanimage does both detection and backend pointing but, unfortunately, it will fail with the same message whether hardware detection fails or backend fails. Accordingly, even though scanimage must be working smoothly in order to use GUI frontends (eg Xsane), sane-find-scanner is very useful to troubleshoot hardware detection.
$ sane-find-scanner
...found USB scanner (vendor=0x05e3, product=0x0145) at libusb:002:009

$ 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).
Success with hardware. However, scanimage -L subsequently failed, meaning the backend is misconfigured or missing. To solve this, we have two options -- modify the rules or force scanimage to call backends (stored in /usr/lib/sane) using CLI switches.

software

Before writing a rule, we'd like to see how the kernel names the device, ie, what is the /dev device node's name? I typically use dmesg but, in my friend's system, dmesg was not supplying it. Also, his /dev folder had no "usb" folder. I located the usb folder /dev/bus/usb...
$ ls /dev/bus/usb
001 002 003 004 005 006
Opening /dev/bus/usb/002/ revealed "009". Taken together, these correlate with lsusb:
$ lsusb
Bus 002 Device 009: ID 05e3:0145 Genesys Logic, Inc.

vuescan - 235Mb

not sure this will work wihtout removing hplip

$ yay -s vuescan
1 aur/vuescan-bin 9.7.82-2 (+42 0.50)
A powerful proprietary scanning tool developed by Hamrick Software

udev rules

Only if need be. I had enough to go after the necessary /etc/udev/rules.d information:

# udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/002/009)

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device '/devices/pci0000:00/0000:00:12.2/usb2/2-2':
KERNEL=="2-2"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{bDeviceSubClass}=="ff"
ATTR{bDeviceProtocol}=="ff"
ATTR{devpath}=="2"
ATTR{idVendor}=="05e3"
[snip]

looking at parent device '/devices/pci0000:00/0000:00:12.2/usb2':
KERNELS=="usb2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{devpath}=="0"
ATTRS{idVendor}=="1d6b"
[snip]

looking at parent device '/devices/pci0000:00/0000:00:12.2':
KERNELS=="0000:00:12.2"
SUBSYSTEMS=="pci"
DRIVERS=="ehci-pci"
ATTRS{irq}=="17"
ATTRS{subsystem_vendor}=="0x1179"
[snip]

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""

/etc/udev/rules.d

Tried this rule...
# nano /etc/udev/rules.d/10-primefilm.rules

# Custom for Primefilm scanner
KERNEL=="2-2", SUBSYSTEM=="usb", \
ATTRS{idVendor}=="05e3", ATTRS{idProduct}=="0145", \
GROUP="scanner", MODE="0664", \
ENV{libsane_matched}="yes"
This rule worked correctly, as tested with...
# udevadm test $(udevadm info -q path -n /dev/bus/usb/002/009) 2>&1
...however I continued to see scanimage -L fails. This means backend trouble -- typically complicated.

scanimage and sane-config

In /usr/lib/sane, I noted two libsanes which might work as backends, viz libsane-pie, and libsane-genesys. Sane wasn't automatically pointing to either of these, so they hadn't been used. We can make it do that with the CLI. Neither appeared to work:
$ scanimage --device=pie:/dev/bus/usb/002/009
scanimage: open of device pie failed: Invalid argument

$ scanimage --device=genesys:/dev/bus/usb/002/009
scanimage: open of device genesys failed: Invalid argument

Wednesday, July 10, 2013

xsane rabbit hole

Links: scanimage man page :: clear overview of network and usb scanners, groups

I recently connected a mothballed Epson that scans on every system, but found that it didn't work in Fedora. The sane-find-scanner utility detected the scanner, but scanimage -L did not (as root or user). This is apparently a common problem, sometimes associated with permissions, sometimes random bugs.

I did get it to scan by manually entering the USB address detected by sane-find-scanner, and add the library suffix for Epsons* from /usr/lib/sane/. This looks like, eg...
$ scanimage -d epson2:libusb:001:005 --resolution 75 --mode Gray > star.jpeg
$ convert star.jpeg -normalize out.jpg
Conversion (ImageMagick) is required because the output image caused errors "not jpeg starts 0x50 0x34". The Start of File (SOF) was not the correct header for a JPEG. This is because it's really a PGM file. Anyway, scanning in this way would be prohibitively time intensive.

*attempted both /usr/lib/sane/libsane-epson and /usr/lib/sane/libsane-epson2

$ scanimage --help --device-name epson:libusb:001:005

Options specific to device `epson:libusb:001:005':
Scan Mode:
--mode Lineart|Gray|Color [Lineart]
Selects the scan mode (e.g., lineart, monochrome, or color).
--dropout None|Red|Green|Blue [None]
Selects the dropout.

--gamma-correction User defined (Gamma=1.0)|User defined (Gamma=1.8) [User defined (Gamma=1.8)]
Selects the gamma correction value from a list of pre-defined devices
or the user defined table, which can be downloaded to the scanner
--resolution 75|150|300|600dpi [75]
Sets the resolution of the scanned image.
--speed[=(yes|no)] [no]
Determines the speed at which the scan proceeds.

--short-resolution[=(yes|no)] [no]
Display short resolution list
--red-gamma-table 0..255,...
Gamma-correction table for the red band.
--green-gamma-table 0..255,...
Gamma-correction table for the green band.
--blue-gamma-table 0..255,...
Gamma-correction table for the blue band.

--wait-for-button[=(yes|no)] [no]
After sending the scan command, wait until the button on the scanner
is pressed to actually start the scan process.
Preview:
--preview[=(yes|no)] [no]
Request a preview-quality scan.
--preview-speed[=(yes|no)] [no]

Geometry:
-l 0..215.9mm [0]
Top-left x position of scan area.
-t 0..297.857mm [0]
Top-left y position of scan area.
-x 0..215.9mm [215.9]
Width of scan-area.
-y 0..297.857mm [297.857]
Height of scan-area.
--quick-format CD|A5 portrait|A5 landscape|Letter|A4|Max [Max]

strace

Stracing scanimage revealed that the appropriate lsusb.so was consulted, but nothing was returned. I also moved all .conf files in /etc/sane.d/ except the epsons, in case the client was could not locate the appropriate .conf file from the 30 or so in that folder. No luck.

saned

One article (link is also at top of page), seemed to imply that saned was necessary to run the scanner. I considered saned (configured via /etc/sane.d/saned.conf) only necessary for network access to scanners, and so looked more closely.

Saned and CUPS appear similar, at least in concept. Since I could find no clear guideline for the syntax for adding USB printers into saned, it's possible they are added to /etc/sane.d/saned.conf in a similar USB URL format as in CUPS, eg usb:/dev/usb/lp0. But it appears we may have to more specific about which USB and so include each:


groups

The Fedora installation had no group for scanning. It might be necessary to add a "scanner" group and create user access. If there is an underlying permissions issue, this might resolve it.

Wednesday, April 27, 2011

cups - brother mfc-8840d

Links:  Openprinting.org (Printing)      Sane project (Scanning)    Brother (manufacturer)

pt1: printing

A friend has an older Brother printer, the MFC-8840D (device code 04f9:0160), an all-in-one copy-print-fax machine. He mentioned that the machine is reachable via its USB port or via a built-in WiFi card, but neither were apparently operating consistently with his XP box. It piqued my interest because I hadn't previously configured a WiFi printer w/Linux. The MFC8840D seemed like a good place to start -- Openprinting.org noted it has "excellent" performance with Linux.
1. Accordingly, began at Openprinting.org and retrieved the ppd file. Renamed the file "brothermfc8840d.ppd" for ease of use and copied it into /usr/share/cups/model. CUPS locates printer information files in that directory.

2. In order to use lpadmin, turned-on CUPS:
# service start cups
Added the printer:
# lpadmin -p Brother -E -v socket://192.168.1.101/printer -m brothermfc8840.ppd
Printer installed and the /etc/cups/printers.conf file was properly generated. Only remaining task was to retrieve the HOSTNAME and TCP/IP info from the printer and update /etc/cups/printers.conf in a text editor with this info.

3. Walked to printer to retreive info but, ah-hah!, it turned out there was no WiFi in the Brother MFC-8840D. The networking capacity my friend apparently hoped was WiFi is only Ethernet. The printer has 3 ports: USB, Ethernet, and parallel. I went ahead and completed the install using USB so my buddy could determine whether his previous printing problems were in XP or the printer itself.

4. Turned the printer on and connected the USB cable to my laptop, running # udevmonitor to get the port name "/usb/lp0". I then opened /etc/cups/printers.conf and changed the URI to a USB connection:
# cat /etc/cups/printers.conf
# Printer configuration file for CUPS v1.3.9
# Written by cupsd on 2011-04-27 23:00
<Printer Brother>
Info Brother
DeviceURI file:///dev/usb/lp0
State Idle
StateTime 1303970446
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy stop-printer
</Printer>

5. Restarted CUPS so that CUPS re-read the printers.conf file with the updated USB information:
# service restart cups
Prints without any apparent problems. Installation time: 10 minutes. Did not initialize or verify the printer's scanner operation.

pt2: scanning

Links: Howto w/scripts   Howto w/scripts   Gentoo Howto

Looked through the SANE database and noted Linux compatibility with the MFC-8840D is listed as "good". That said, a person can go with a simple or a very involved scanner installation. Below, I include both but break it into two parts. For simple scanning using the Xsane GUI, the simple installation will do. For OCR, specialized file handling, and so forth (all of this is possible), a complete install may be necessary. Before I start on these, some checks and the procedures which apply to both a simple of full install are provided.

Checks  The scanner portion of the Brother can be difficult for the system to detect. These checks provide confirmation of detection and useful information during any stage of the installation. Use freely:
$ scanimage --test
$ scanimage - L
$ brscan-skey -l
$ sane-find-scanner
Necessary  
  • Verify "brother" is in the list in the /etc/sane.d/dll file. If it is not, add it.
  • The sane configuration directory must have a "brother.conf". Check with ls /etc/sane.d/. If there is no brother.conf, make one. Get the printer device number using $ sane-find-scanner and then make the file:
# nano /etc/sane.d/brother.conf
usb 0x4f9 0x16e
option connect-device

Preference: I run programs as "user", not "root", so I changed the permissions for this device by simply moving it into my user-level 'lp' (printer) group. First found the device in my rules:
# cat /etc/udev/rules.d/30-scanners.rules |grep "Brother MFC-8840"
# Brother MFC-8840D
Second, went to line 915 and changed permissions and groups. Before the changes:

ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="0160", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"
After changes:
ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="0160", MODE="0666", GROUP="lp", ENV{libsane_matched}="yes"
With these in place, moved on to the software.

A. Simple Installation ~ 10 minutes

A1. Proprietary Brother scanning software. This is supposedly freely available at the Brother site. The Brother site maintains only .rpm/.deb files. I run Slackware, so I used rpm2tgz to convert and then installpkg:

$ cd downloads
$ rpm2tgz brscan*
$ mkdir brscan
$ cp brscan-0.2.4-0.i386.tgz /brscan
$ cd brscan
$ su
# installpkg brscan-0.2.4-0.i386.tgz
# exit
$ brsaneconfig (it works)
A2.Check scanner operation:
$ scanimage --test
A3. Open XSane in the menu and scan sh*t.

B. Full Installation ~ 8 hrs

B1. Install the 32 bit brscan.

$ cd downloads
$ rpm2tgz brscan*
$ mkdir brscan
$ cp brscan-0.2.4-0.i386.tgz /brscan
$ cd brscan
$ su
# installpkg brscan-0.2.4-0.i386.tgz
# exit
$ brsaneconfig (it works)
B2. Install the 32 bit brscan-skey.

$ cd downloads
$ rpm2tgz brscan-skey*
$ mkdir brscan
$ cp brscan-skey-0.2.1-3.i386.tgz /brscan
$ cd brscan
$ su
# installpkg brscan-skey-0.2.1-3.i386.tgz
# exit
$ brscan-skey (it works)

B3. Check it:
$ brscan-skey -l
MFC-8840D : brother:bus6;dev1 : USB Not registered
$ sane-find-scanner
found USB scanner (vendor=0x04f9, product=0x0160) at libusb:002:003
$ scanimage -L
device `brother:bus5;dev1' is a Brother MFC-8840D USB scanner
B4. At this point, the scanner scanned just fine, but the jpg was not saved and I was getting the error message:
ERROR: No such file or directory [/usr/local/Brother/sane/brscan-skey-0.2.1-3.cfg]
B5. Must therefor create the file /usr/local/Brother/sane/brscan-skey-0.2.1-3.cfg
# nano /usr/local/Brother/sane/brscan-skey-0.2.1-3.cfg
password=
IMAGE="sh /usr/local/Brother/sane/script/scantoimage-0.2.1-3.sh"
OCR="sh /usr/local/Brother/sane/script/scantoocr-0.2.1-3.sh"
EMAIL="sh /usr/local/Brother/sane/script/scantoemail-0.2.1-3.sh"
FILE="sh /usr/local/Brother/sane/script/scantofile-0.2.1-3.sh"
SEMID=b

B6. Must then create a script for each desired function. This site has samples of all of them. There are limitless tweaks for file size, OCR use, etc etc etc. Can go crazy with this -- the scripts are entirely configurable for nearly any function.

pt3: faxing

No phone available here, but this appears relatively straightforward and the software is likewise available at the Brother site.