Troubleshooters.Com®, Linux Library, and T.C Void Linux Subsite Present:

Void Linux: Using Xsane With a Brother MFC-L5850DW Scanner

See the Troubleshooters.Com Bookstore.

Contents:

Introduction

Brother printers and scanners are famous for their Linux comparability, but there's a caveat. They give you all the necessary software for the scanner, as long as your Linux distro's packaging system is Debian or Redhat compatible. They have a source code package download directly from brother-usa.com, but I found this source impossible to get running on my Void Linux system, which uses the XBPS packaging system. XBPS is not supported by Brother.

Note:

This is being written on November 1, 2025, when the Brother-USA.Com site is down for maintenance, so it's possible that it now has better support for non-Debian, non-Redhat derived distros, but as of today this can neither be proved nor disproved, so I'll go on my memories of past attempts to get xsane working on my Void system with my Brother MFC-L5850DW series printer/scanner.

This document tells the story of how I got Void, xsane and my scanner to work together. It's a story, not a set of instructions. It may or may not work for you. I have a feeling that it will prove valuable to quite a few people with non-Debian, non-Redhat packaging systems, but that's just my suspicion.

I've been trying unsuccessfully to get xsane working with this scanner for ten years. Today, ChatGPT helped me set it up in less than an hour. Many will argue that if I were smarter/more technical/better reader/etc I wouldn't have needed to resort to ChatGPT, which they consider "Vibe Coding". OK fine, for sure for sure, but even with my supposed low IQ ChatGPT helped me solve this problem in less than an hour.

My Setup

My setup is as follows:

How It Works, Overview

This section describes the bare minimum architecture information about the system, in order that you can understand how I got things to work. A later section goes into more detail.

From User to Scanner

Simple Mental Model of Brother scanner under Linux

In the preceding diagram, going in the direction from user to scanner:

  1. User controls the xsane program.

    xsane is a GUI program providing a human interface to the scanner. It first finds the scanner, then provides the human interface. xsane enables the user to easily make choices such as output file, flatbed glass or document feeder, color model, resolution, geometry, histogram editing, and other things depending on the scanner's capabilities. It also provides a very nice previewer that scans at a very low resolution to speed things up, then allows you to crop, histogram, lighten, darken, etc, as needed.

  2. xsane makes API calls to libesane.so.

    libsane.so is an API for an idealized scanner. The SANE system uses it for all scanners.

  3. libsane.so makes driver calls to the brscan5 driver.

    libsane.so translates these high level idealized API calls into driver calls the scanner's driver recognizes, and sends those drivers to Brother's brscan5 driver software. On Void Linux, the brscan5 driver software is actually located at /usr/lib/sane/libsane-brother5.so, which is provided by Brother.

  4. brscan5 driver sends scanner commands to the scanner.

    First of all, the brscan5 driver is actually /usr/lib/sane/libsane-brother5.so on Void Linux. Your mileage may differ with different distros. This is a .so file, not a .ko file, meaning it's a userspace driver, not a kernel space driver, meaning that its calls go to the kernel for handling, as opposed to going straight to the scanner. The purpose of a driver, any driver, is to translate software commands into "stuff" for the hardware, where "stuff" might be data over a protocol, or a voltage or current, or a frequency, or a measure of movement, or pretty much anything else. The driver is the converter between software/data and physicality.

From Scanner to User

Simple Mental Model of Brother scanner under Linux

In the preceding diagram, going in the direction from scanner to user:

  1. Scanner sends errors, warnings, status and scanned images to brscan5 driver
  2. The brscan5 driver translates the received information to a form that libsane.so API can understand and sends it to the libsane.so API.
  3. The libsane.so API translates the information to a form xsane can understand, and sends it to xsane.
  4. xsane displays the information in a form the user can work with.
  5. The user reads the information.

Dynamic Loading

xsane dynamically loads API libsane.so so the API code is available to xsane. Then the code in libesane.so loads the code in the brscan5 driver. The brscan5 driver is located at /usr/lib/sane/libsane-brother5.so on Void Linux. Now the driver is available to the API, and therefore indirectly to xsane.

The preceding brings up an obvious question: How do all these softwares know how to load each other? This is an especially vexing question because different Brother scanners use different driver software. Brscan5, brscan4, and brscan3 all provide drivers for different sets of Brother reasonably modern scanners, with brscan2 and brscan1 covering ancient scanners you might find at an estate sale for an octogenarian couple. Further complicating all of this is that different brands of scanners need different drivers, and you might have a system with multiple scanners. Ugh!

The answer is simple: Config files are queried to get the information. The following diagram shows those config files and the program used to set one of them, completing your Mental Model of the Void to Brother-Scanner interface:

Complete Mental Model of Brother scanner under Linux

The following is a list of the labels on the preceding diagram, and their full filenames on my computer:

xsane
/usr/bin/xsane
libsane.so
/usr/lib/libsane.so.1
brscan5 driver
/usr/lib64/sane/libsane-brother5.so.1
dll.conf
/etc/sane.d/dll.conf
brsanenetdevice.cfg
/opt/brother/scanner/brscan5/brsanenetdevice.cfg
brsaneconfig5
/usr/bin/brsaneconfig5

The following list overviews the purposes of these config files:

Network Scanners And Firewall Settings

Your scanner driver communicates with your networked scanner via TCP and UDP. Brother has specified the following two ports for communication to a network scanner:

These aren't IANA registered ports, but their use is pretty well known. So, to get the Brother scanner to communicate with a networked scanner, the following two rules must be added to your iptables:

-I INPUT -p tcp --dport 54921 -j ACCEPT
-I INPUT -p udp --dport 54925 -j ACCEPT

In most cases you can change the -I to -A if you want to, unless a previous rule contradicts this one. Note that these ports aren't opened for OUTPUT. This is because most Linux firewalls are default open for all OUTPUT and all protocols. If yours is locked down tight, default denying OUTPUT, you'll need to add another two rules to open the same ports for the same protocols for OUTPUT.

What is saned?

saned is a server daemon to make your USB connected scanner available on your LAN. My scanner is connected via the network, so the SANE software and the printer driver can be put on any computer on my LAN so the scanner could be used by any computer on the LAN.

But what if my scanner were connected to my computer via USB and didn't have network capability? In that case, the only way to make the scanner available LAN wide would be to run the saned server, so SANE software on other computers could access the sane server. It's usually a bad idea to run saned if your scanner has network capabilities, because of the added redundancy, complexity, and security issues.

saned operates on port 6566 using TCP.

How I Fixed the Problem

Different software issued different error messages, but the majority of software failed to find a scanner. The following is a list of steps I took, but not necessarily in this order:

What I Mean by "Ask AI"

Several places in this document I've suggested you "ask AI" when you get stuck at a step. ChatGPT is one AI, specifically a Large Language Model (LLM), amenable to repeated refinement of questions. Other LLMs include Claude, Perplexity.AI, and several others.

For a quick and dirty answer to a question, Google is your friend, because it produces an AI answer to your specific closed ended question, something like one of the following:

On the first two queries Google gives helpful results. On the third query its lack of specificity produces ambiguity rendering its response useless.

When querying Google, it's vital to make your question unambiguous. It's also necessary to make it a narrow range question that can be answered with one response. You want Google to think convergently, not divergently. If you don't know what I mean, ask Google the following two questions:

Google's AI will give you the needed answers. With Google AI's current capabilities, today you rarely need to use Dictionary.Com.

How to Interact With an LLM

Effectively querying an LLM (Large Language Model) is a skill. Make your question(s) specific and non-ambiguous. If working on a problem, tell the LLM what diagnostic tests you've done so far, and the observed results. Ask the LLM "Please tell me a maximum of three diagnostic tests I should do next to narrow down this problem. The reason I put a maximum of three on it is to prevent it from turning into a costly (in terms of money, electricity, etc) brainstorming session."

The following is my initial query about scanning, made to ChatGPT:

I have a Brother MFC-L5850DW series printer with scanner connected to my Void Linux computer. The Brother printer/scanner is at 192.168.0.1, which is on my local 192.168.0 subnet. The computer works just fine with the printer portion, but not with the scanner, so I must scan to USB and sneakernet to my computer. Very inconvenient.

I was unable to get xsane to help me. I was unable to get /opt/brother/scanner/brscan5/brsaneconfig5 -q to detect my scanner at http://192.168.0.13/general/status.html , even though my browser finds my Brother printer at that address.

How can I take a step closer to being able to control my scanner from my Void Linux computer?

Several things about my preceding prompt: I initially said the printer/scanner was at 192.168.0.1, when it was really at 192.168.0.13. Later, when I corrected that, ChatGPT took it in stride. Notice I described the printer's network setup, and the thumb-drive-sneakernet stuff I had to do to scan things. I revealed how xsane wouldn't find the printer at 192.168.0.13, even though I could browse to that address with my browser. My final question was "How can I take a step closer to being able to control my scanner from my Void Linux computer?" I phrased it that way to keep it specific and avoid divergent brainstorming.

In fact, ChatGPT gave me about six diagnostic moves. With a very short discussion, all the problems were solved and xsane could control my scanner.

Trust, But Verify

When speaking of the Soviet Union in the 1980's, president Ronald Reagan said "trust, but verify". The same is true of LLMs today. Speaking at least for ChatGPT, which I know the most about, it's against ChatGPT's principles to utter the words "I don't know." I presume other LLMs are trained the same way. So you need to verify everything your LLM tells you, either by putting it into action, consulting other LLMs, consulting mailing lists and IRC channels, or performing web searches.

Like that teacher you had a long time ago who knew less than you, you need to say "but then how does so and so happen?" The teacher or LLM then reconsiders and gives a more informed answer.

This is also the reason why you don't have your LLM write whole programs for you. That humongous program is bound to contain errors that would take you an hour or more, or perhaps days to find. Instead you ask your LLM about one data structure, or one class, or one algorithm, get that working and use it as a module. This is the way you use LLMs to build muscular, durable software, or find durable, muscular ways to accomplish something such getting xsane and a network printer to work together.

Why I Chose to Use an LLM

I chose to use an LLM because it's correct more often than your average developer, admin or dev-op. Not the best developer, admin or dev-op, but the average one. And these days, with everyone claiming to be a "10x Engineer" (saaaay whaaaat?), finding a competent person to give you advice is a needle in a haystack. And even if you find him or her, you can bet others will have found them too, and they'll be way to busy to give you the individual attention you need for a quick solution. So like it or not, you're back to asking average technologists, and they're wrong a lot more than your LLM, assuming you pay the same attention to asking unambiguous questions and supplying unambiguous information to each.

When you ask a question on your favorite mailing list or IRC channel, you'd better have done your homework. Read the Fantastic Manual (RTFM). Perform a web search. Never mind that today's manuals are incomplete, ambiguous and often just plain wrong. And as far as a web search, many of them answer the wrong question. Many give answers for 13 year old software. Many are just what worked for the individual, paying no attention to the underlying technology. Many are fourth hand copy/modifies that are just plain wrong.

So finally, 20 minutes later, you've done your homework and ask your question. And BANG, somebody's going to call you stupid, say you should use a different product (with no knowledge of your situation). Then others jump in, hijack the conversation and steer the conversation t some distant tangent, of course without changing the subject line. So you need to peruse 50 email messages to find one that talks about your initial question.

Or else your question is greeted with silence, even by people who know the answer. You can even prove they knew the answer by invoking Steve Litt's Surefire Way to Get Answers.

There was a time when mailing lists, IRC channels, web searches and manuals were the best game in town, but with the advent of LLMs, that's all changed. In a few seconds, an LLM can consider hundreds of web posts, find areas of agreement, and give you an answer with a pretty good likelihood of being right. Then you just verify, implement and troubleshoot, for an excellent modular solution.

Understanding What You've Done

Getting it working isn't the end of your duties. You must understand what you've done. Continue asking your LLM why it recommended something or how something works, until you could do it yourself. Armed with this knowledge, you can debug it as needed, or add features. Also, this knowledge makes it much easier for you to accomplish similar tasks, and the more tasks you complete in the tech sphere, the more resemblance you see between new tasks and the tasks you've already completed.

How It Works: Detailed Mental Model

This section gives the almost complete Mental Model of the Linux xsane interface to a Brother scanner.

Wrapup

Early on, I had proof that my Brother MFC-L5850DW series printer/scanner was available and reachable on my LAN (Local Area Network), and that the printer part worked just fine over the network. I also saw the main symptom as the inability of xsane or any other program run from my Void Linux desktop computer to make the scanner do anything. Consulting ChatGPT, I found out:


[ Training | Troubleshooters.Com | Email Steve Litt ]