Epson DS-40 scanner on Linux

In my recent continuous attempt in getting rid of things bulky and/or replacing them with compact and simpler/multipurpose tools (I collectively refer to all these efforts as minimalism), I came across my bulky, but trusty, scanner which is part of a multifunction that I purchased for 20 AUD back in 2009. It had outstanding quality and served me for 7 flipping years and 3500 scans. It still works fine but, you know, it’s big for what it does. So I went and did some research and found Epson DS-40 document scanner. It’s not a flatbed but given its size and capabilities as well as my use cases, I’m OK with the compromise. One little thing though — not easy to get it working on my Archlinux installation.

After few hours of headbanging, I gave up trying to make the seemingly well written official driver and scanner utility to work. While I was busy doing this, I read through some of the code and it turns out the protocol the scanner talks is very straightforward. So I decided to hack together a script to see if I could get an image out of it myself. Lo and behold, it was a piece of cake, in less than 150 lines of python code with PyUSB as the only dependency written in less than half an hour, with the help of the official code and a dump of USB packets between the windows driver and the scanner.

It is true that this script doesn’t handle any but the simplest of errors and that’s OK for now because after a few dozen scans it seems to work fairly robustly. When and if it breaks, I’ll fix it.

I plan to add WiFi setup and scanning capabilities as well as Python 2 compatibility to the script to make it a truly one stop shop. Meanwhile, if someone else gets the official stuff working on Arch and it turns out to be better than what I have, I’ll abandon my script in a flash. Until then, how about some minimalistic scanner driver!