Skip to content

Instantly share code, notes, and snippets.

@Wonno
Last active June 1, 2024 14:13
Show Gist options
  • Save Wonno/dd392209efe1d25d98e332a020be8e61 to your computer and use it in GitHub Desktop.
Save Wonno/dd392209efe1d25d98e332a020be8e61 to your computer and use it in GitHub Desktop.
Revive aging document scanners

Revive aging document scanners

Problem

Many vendors of nowadays quite old image and document scanners offer no updated drivers for Windows 10 and newer. Usually only 32bit drivers are available up to WinXP, Vista and Win7. After all, since Windows 10, most of us are running 64bit systems converting those devices into bricks - unless you use Linux.

Solution: Use Linux - in our case WSL provided by Windows to resurrect those beloved scanners.

Preconditions

💡 Versions I used to run things:

  • Win 11

    Version 23H2 (Build 22631.3593)

  • WSL

    WSL-Version: 2.1.5.0
    Kernelversion: 5.15.146.1-2
    WSLg-Version: 1.0.60
    MSRDC-Version: 1.2.5105
    Direct3D-Version: 1.611.1-81528511
    DXCore-Version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Windows-Version: 10.0.22631.3593

  • Debian

    12.5 Bookworm 5.15.146.1-microsoft-standard-WSL2

Installation: Windows

1. Install usbipd-win and reboot

:: admin cmd
winget install --interactive --exact dorssel.usbipd-win

:: reboot
shutdown /r  /t 0

Optional: Install wsl-usb-gui

2. Verify installation

:: cmd
usbipd --version

4.2.0+54.Branch.master.Sha.5b36605535dd52bc3d8a8e4bbaee7f4d480c86ad

3. List connected USB-Devices

:: admin cmd
usbipd list
 Connected:  
 BUSID  VID:PID    DEVICE                                                        STATE  
 ....  
 2-1    03f0:1005  HP Scanjet 5400C Series                                       Not shared  
 3-2    03f0:2112  Officejet Pro L7500, HP Officejet Pro L7500, USB-Massensp...  Not shared

Identify hardware-ID (VID:PID) of your device
e.g. HP Scanjet 5400C Series ➡️ 03f0:1005

4. Bind the Device

:: admin cmd
usbipd bind --hardware-id 03f0:1005

5. Attach device to Debian-WSL

:: cmd
usbipd attach --hardware-id 03f0:1005 --wsl

Links

Installation: Debian

1. Prepare Debian for systemd

Add entry to /etc/wsl.conf (create file if not exists)

[boot]
systemd=true

2. Restart Debian-WSL

:: cmd
wsl --terminate Debian

3. Install dbus

sudo apt-get install --reinstall dbus
sudo systemctl start dbus
sudo systemctl status dbus

4. Install Scanner software

sudo apt install usbutils
lsusb

💡 Choose one or as many you like:

a) xsane

sudo apt install xsane
# Add current user to group
sudo usermod -a -G scanner $(whoami)   

# run the software - can be also launched from Windows Startmenu
xsane &

b) simple-scan

sudo apt install simple-scan
# Add current user to group
sudo usermod -a -G lp $(whoami)   

# Optional: Scaling on hires displays
export GDK_SCALE=2
export GDK_DPI_SCALE=2

# run the software - can be also launched from Windows Startmenu
simple-scan &

c) HP's Linux Imaging and Printing software

💡 Check HP's Linux Imaging and Printing software (HPLIP) is on support list first

sudo apt install hplip hplip-gui python3-pyqt5

# Optional: Scaling on hires displays
export QT_AUTO_SCREEN_SET_FACTOR=0
export QT_SCALE_FACTOR=2
export QT_FONT_DPI=96

# run the software - can be also launched from Windows Startmenu
hp-toolbox &

Problem/Solution 😧

Verify if USB Scanner device available:

sudo sane-find-scanner
sudo scanimage -L

Notes

Inspired by Reviving an older printer with Ubuntu WSL and Printer Application Snaps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment