Canon LIDE 110:每次扫描时都应重新连接 USB

Canon LIDE 110:每次扫描时都应重新连接 USB

我有一台 Canon LIDE 110 扫描仪,默认情况下可在 ubuntu 12.10 64 位上运行。问题是第一次扫描后我无法进行第二次扫描。我应该重新连接 USB 电缆才能再次使用扫描仪。

我使用简单的扫描应用程序来扫描照片和文本。lsusb 显示我的扫描仪如下:

Bus 003 Device 010: ID 04a9:1909 Canon, Inc. CanoScan LiDE 110

我试过 USB 2.0/3.0 端口。两者都发生了相同的情况。

dmesg 显示:

[ 7747.558086] usb 3-3: new high-speed USB device number 11 using xhci_hcd
[ 7747.575766] usb 3-3: New USB device found, idVendor=04a9, idProduct=1909
[ 7747.575775] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 7747.575779] usb 3-3: Product: CanoScan
[ 7747.575782] usb 3-3: Manufacturer: Canon

我该如何解决这个问题?提前感谢大家提供的建议。

答案1

@jeekajoo,您的错误已标记为“已修复”https://bugs.launchpad.net/ubuntu/+source/sane-backends/+bug/1184699(虽然事实并非如此)所以我认为没人关注。

我发现避免错误的唯一方法是在每次扫描会话之间重置(拔下 + 重新插入)扫描仪。但除了物理重置之外,还可以使用此处描述的“usbreset”如何从命令行重置 USB 设备? 它非常快,几乎不会减慢扫描过程。这是我编写的一个小脚本,可以快速将多页扫描成一个 PDF

#!/bin/bash
#let's store the usb ID "BUS" and "DEVICE" of our scanner (04a9:1909 is the usb ID of the Canon Lide 110 when executing lsusb)
canon_bus=$(lsusb | grep '04a9:1909' | cut -c 5-7)
canon_device=$(lsusb | grep '04a9:1909' | cut -c 16-18)

#let's start the scan in batch mode with a resolution of 150 dpi. --device-name is not mandatory but it starts faster when indicated
scanimage -p -b --batch-prompt --device-name=genesys:libusb:$canon_bus:$canon_device --resolution 150 --mode color

#let's convert all *.pnm generated files into pdf
mogrify -format pdf -page a4 -- *.pnm && rm *.pnm

#let's reset the scanner so it is available next time we want to use it. The "usbreset" binary must be compiled from https://askubuntu.com/questions/645/how-do-you-reset-a-usb-device-from-the-command-line
./usbreset /dev/bus/usb/$canon_bus/$canon_device

#let's merge all PDF but only if there are more than one page (so 1 PDF)
nb_pdf=$(ls -1 *.pdf | wc -l)
if [ $nb_pdf -gt 1 ]; then
#let's merge all PDF. We use the "ls -v" command to merge them in a numerical order (otherwise the page 10 would be before the page 2). Thank you "Ymonad" at http://stackoverflow.com/questions/23643274/linux-command-merge-pdf-files-with-numerical-sort for this solution!
    ls -v *.pdf | bash -c 'IFS=$'"'"'\n'"'"' read -d "" -ra x;pdfunite "${x[@]}" temp_merge' && rm *.pdf
else
    mv *.pdf temp_merge
fi

#let's compress the merged pdf
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/default -dNOPAUSE -dBATCH -sPAPERSIZE=a4 -sOutputFile=scan.pdf temp_merge && rm temp_merge

我希望它能够帮助其他人!

答案2

Ubuntu 14.04 官方存储库仍为 sane-backends 版本 1.0.23,但我通过从https://launchpad.net/~rolfbensch/+archive/ubuntu/sane-git

如果你仍然想使用我的扫描脚本,你现在可以跳过“usbreset”步骤

相关内容