The mystery of the disconnecting printer

LaserJet 4
I like printers.
For long time, as a teenager, I wanted a dot matrix printer. I liked the noise, as well as their ability to print on a continuous feed of paper.
I still remember the time when my father brought home a laser printer from the office. It was an HP LaserJet 4, and I still remember the smell of the toner and the quality of the print, especially compared to the whatever I had seen printed until that time.

Maybe that memory plays a role but nowadays, I am a strong proponent of networked laser printers.
A monochromatic laser printer does not cost much more than a good quality inkjet, and most of the times, you do not need to print in colors.
The huge difference is that you essentially forget maintenance. Toner will last a long time, whereas my experience with cartridges is that they are always empty, especially when you need them.
Wireless means that you do not need to think about cables, and you can print from any computer without any special setup.
In other words, it’s a hassle-free setup.

That is, until it does not work.
Somehow, my Brother DCP-L2532DW started to have performance issues: print jobs could take a long time to complete, and scans could wait even 30 seconds before even starting a new page.

As usual, the first tool is the old and trusted ping; and yes, pinging the printer showed that the reason lied in the network connectivity:

➜  ~ ping scriptorium.lan
PING scriptorium.lan ( 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
Request timeout for icmp_seq 9
Request timeout for icmp_seq 10
Request timeout for icmp_seq 11
Request timeout for icmp_seq 12
Request timeout for icmp_seq 13
64 bytes from icmp_seq=10 ttl=255 time=4647.191 ms
64 bytes from icmp_seq=11 ttl=255 time=3644.091 ms
64 bytes from icmp_seq=12 ttl=255 time=2642.913 ms
64 bytes from icmp_seq=13 ttl=255 time=1640.443 ms
64 bytes from icmp_seq=14 ttl=255 time=636.595 ms
64 bytes from icmp_seq=15 ttl=255 time=11.462 ms
Request timeout for icmp_seq 20
Request timeout for icmp_seq 21
Request timeout for icmp_seq 22

Searching the internet for the issue gave almost no result. Most of the troubleshooting focuses on driver-related issues, which here is clearly not the case.
So, I tried to reset the connection, but it achieved nothing except wasting quite a long time setting up the printer again.
I tried disabling as many services as possible, update the firmware, and even disabling IPv6. Again, no luck.
Not only: disabling SNMP prevented iPrint&Scan to recognize the printer at all, contrarily to what was available on some website.

Eventually, I found some obscure information on ifixit, about another Brother printer, which could not remain connected to WiFi. In particular, in one of the replies, I discovered that Brother printers have compatibility issues with some routers (!).
Now, my WiFi setup is slightly advanced, because I enabled 802.11r (Fast Roaming/Transition): maybe that was the issue?
I quickly created a new wireless network, without fast transition (the printer does not move much anyway), and yes, for a while the problem were gone.
This corroborated the theory that the printer driver is not fully compatible with 802.11r, so a different network could help.

Unfortunately, after a couple of days the situation was back to be very problematic. However, this time I already had some working theory (old driver with compatibility issues), so I immediately checked the network settings; and yes, “Allow legacy 802.11b rates” was still unchecked. Unchecking it caused a printer bought in 2020 to work flawlessly and reliably.
According to OpenWRT forum, unchecking that flag will help a lot in improving the overall wifi reliability, especially in a setup with multiple access points; however it will cause older devices to stop working. And that was exactly what happened with my printer – again, bought in 2020.

TIL: even in 2022, printers have buggy drivers. In the specific case of Brother, using a plain network setup will increase the chances to have a reliable connection.