Skip to content

Instantly share code, notes, and snippets.

@rhiroyuki
Last active March 17, 2019 19:02
Show Gist options
  • Save rhiroyuki/1504a2efd8cc82fb02d4993cdb832948 to your computer and use it in GitHub Desktop.
Save rhiroyuki/1504a2efd8cc82fb02d4993cdb832948 to your computer and use it in GitHub Desktop.
Lexmark x1180 Scanner Arch/Manjaro

Making Lexmark x1180 scanner work on Manjaro/Arch linux:

https://wiki.archlinux.org/index.php/SANE
https://www.archlinux.org/packages/extra/x86_64/sane/

Install sane

yaourt -S sane --noconfirm

You may need to unplug and plug the scanner in order to make sane discover it.

List the scanner devices detected by sane:
scanimage -L

Start scanning:
scanimage --format=png > "1.png"

Note: You may need to add the param --device $DEVICE if sane detects more than one device, where $DEVICE is the desired device.

#!/usr/bin/env bash
# Simple and not optimized script made to scan multiple files and not worry about the filename
# Place this script at $HOME/Scans/scan.sh
# Run it with sudo `sudo ./scan.sh` (scanimage requires sudo permissions)
# You need to check and change to the specified device you want to be the scanner
# Run `scanimage -L` and paste the desired device.
# Example:
# $ scanimage -L
# device `v4l:/dev/video0' is a Noname Integrated Camera: Integrated C virtual device
# device `lexmark:libusb:002:016' is a Lexmark X1100/rev. 2C flatbed scanner
# in this case I copy lexmark:libusb:002:016 to scanner_device variable
# PS: The png created may have permission issues since it's created by root
# in order to fix it run this command inside ~/Scans/
# $ sudo chown $USER *.png
scanner_device="lexmark:libusb:002:016"
filename=1
while :
do
echo "Type any key to continue or CTRL+C to stop it:"
read
echo "Checking file existence"
while [ -f "~/Scans/${filename}.png" ]
do
echo "${filename} already exists"
echo "Changing to another filename: $(filename+1)"
filename=$((filename+1))
done
echo "File does not exists, proceeding to scanning"
echo "Scanning to file ${filename}.png"
scanimage --device $scanner_device --format=png > "${filename}.png"
filename=$((filename+1))
echo "Done scanning."
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment