LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-26-2018, 12:07 PM   #1
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Cannot get CanoScan LiDE scanner to work in LFS. Known to work under AntiX


This is a flatbed scanner that uses the plustek driver. usb id is 0x04a9 0x2220. Sane-find-scanner finds it at 004:004 but scanimage -L doesn't. I have tried various recommended options in /etc/sane.d/plustek.conf as suggested in this driver's man page (/dev/usbscanner, libusb 004:004, auto) without success. After googling, I also tried creating a /dev/lide25 link to /dev/usb/004/004 and putting this into plustek.conf, and also creating a sane directory under /run/lock. No luck.

The man page seems to be out of date as it expects to find data in /proc/bus/usb which doesn't exist on modern systems. I wonder if that is the problem.

I have also run it with a high value for SANE_DEBUG_PLUSTEK. Log is attached. One line that puzzles me very much is:
[plustek] ignoring >usb 0x04a9 0x2220<
Is that why it isn't working? But why does it do that?
Attached Files
File Type: txt plustek_scan.txt (11.5 KB, 25 views)
 
Old 09-26-2018, 03:36 PM   #2
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
Quote:
Originally Posted by hazel View Post
This is a flatbed scanner that uses the plustek driver. usb id is 0x04a9 0x2220. Sane-find-scanner finds it at 004:004 but scanimage -L doesn't. I have tried various recommended options in /etc/sane.d/plustek.conf as suggested in this driver's man page (/dev/usbscanner, libusb 004:004, auto) without success. After googling, I also tried creating a /dev/lide25 link to /dev/usb/004/004 and putting this into plustek.conf, and also creating a sane directory under /run/lock. No luck.

The man page seems to be out of date as it expects to find data in /proc/bus/usb which doesn't exist on modern systems. I wonder if that is the problem.

I have also run it with a high value for SANE_DEBUG_PLUSTEK. Log is attached. One line that puzzles me very much is:
[plustek] ignoring >usb 0x04a9 0x2220<
Is that why it isn't working? But why does it do that?
Guessing CanoScan LiDE25? I found it here, which I am sure you already know about: http://www.sane-project.org/sane-mfgs.html#Z-CANON

I had some issues with my lide 220 and they ended up being udev rules - permissions to the usb devices. can you run scanimage -L as root and get results?
 
Old 09-26-2018, 04:04 PM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682

Original Poster
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Quote:
Originally Posted by sevendogsbsd View Post
Guessing CanoScan LiDE25?
Correct!
Quote:
I had some issues with my lide 220 and they ended up being udev rules - permissions to the usb devices. can you run scanimage -L as root and get results?
No, it doesn't work as root either. In any case, I'm pretty sure it's not a permissions problem. If it were, sane-find-scanner wouldn't find the scanner without root privileges, and it does. Also, if you look at the top part of the log, you can see that the scanner is detected at the correct usb bus/port. But then, for some reason, the driver ignores it.
 
Old 09-26-2018, 04:10 PM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682

Original Poster
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Solved! While writing the above, I suddenly thought, "Maybe the usb port is being ignored because I added a second line to the driver configuration file." So I removed it and just left the usb ident line. And now it works.

The built-in comments in the file are very misleading.
Quote:
# each device needs at least two lines:
# - [usb] vendor-ID and product-ID
# - device devicename
# i.e. for Plustek (0x07B3) UT12/16/24 (0x0017)
# [usb] 0x07B3 0x0017
# device /dev/usbscanner
# or
# device libusb:bbb:ddd
# where bbb is the busnumber and ddd the device number
# make sure that your user has access to /proc/bus/usb/bbb/ddd
#
# additionally you can specify some options
# warmup, lOffOnEnd, lampOff
#
# For autodetection use
# [usb]
# device /dev/usbscanner
Notice in particular the requirement for "at least two lines". If you do that, the second line actually wipes out the first, causing it to be ignored!
 
Old 09-26-2018, 04:20 PM   #5
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
Glad you fixed it!
 
Old 09-27-2018, 08:53 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682

Original Poster
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
That didn't fix all of it! After writing the above, I tried an actual scan using xscanimage. It started, then crashed with "Error during device I/O". After that scanimage -L stopped working too.

This morning I tried with Debian using Xsane. Same thing happened. Well, to me that screams "Hardware problem!" I didn't know of course if it was the usb port or the cable that was playing up, so I tried a different port first. Now it works, in Debian anyway. I shall try it again in LFS later. I need to know how much of yesterday's carry on was just due to the port misbehaving rather than a real configuration error. The fact that it suddenly started working after a config file edit could be completely spurious.

Funnily enough, the Debian version of plustek.conf just has
Quote:
[usb]
device auto
No usb device codes at all.
 
Old 09-27-2018, 10:22 AM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682

Original Poster
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
It doesn't work in LFS unless I use sudo. So there's a permissions issue too, at least with this new port. Maybe with the old one too. What threw me is that the "search" programs, sane-find-scanner and scanimage -L, work in my name, but the actual scanning with xscanimage and scanimage>outfile doesn't. Looks like I need to check my udev files.
 
Old 09-27-2018, 10:25 AM   #8
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
Well, at least you are making progress, sort of! I have zero familiarity with LFS so unfortunately am not able to provide any advice there. Based on your sig, I'd say you are quite adept at managing a Linux install
 
Old 09-27-2018, 11:41 AM   #9
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682

Original Poster
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
What seems to be happening is that the usb device keeps disconnecting and then reconnecting with a higher number. I think that is what is throwing scanimage/xscanimage. These programs need a default device spec stored in SANE_DEFAULT_SCANNER, but if it keeps changing, they can't keep up. For example, here is the latest output from scanimage -L
Code:
device `plustek:libusb:007:012' is a Canon CanoScan LiDE25 flatbed scanner
default device is `plustek:libusb:007:011'
Bad cable?

PS: xsane actively scans for devices when it starts up rather than depending on a default scanner. Maybe that's why it works better. But it has a hellishly complex interface and I really don't like it.

Last edited by hazel; 09-27-2018 at 11:53 AM. Reason: added postscript
 
Old 09-27-2018, 12:01 PM   #10
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
Odd - could be the cable, at least that's an easy, cheap test. I agree, xsane isn't the greatest interface. Do the udev rules set the device id? I can't remember - it's been a while since I had to change configuration to get my scanner to work.
 
Old 09-27-2018, 12:38 PM   #11
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682

Original Poster
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Quote:
Originally Posted by sevendogsbsd View Post
Do the udev rules set the device id? I can't remember - it's been a while since I had to change configuration to get my scanner to work.
No, they just assign the new raw usb device to the scanner group. Normally (i.e. if you don't have any disconnects) the device's bus name is set at boot, depending only on what port you plugged it into, and it doesn't change. So if your scanner is always plugged into the same port, it has a constant id that you can store as the default scanner.

Last edited by hazel; 09-27-2018 at 01:01 PM.
 
Old 09-28-2018, 07:42 AM   #12
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682

Original Poster
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Yes, it was the cable. I'm using a different one now and there are no more disconnect/reconnect episodes. Result: my scanner now has a fixed usb address and scanimage/xscanimage works normally.

All the same, there should be a software solution for this. It is easy enough to get udev to run a script when a particular event (such as a usb device re-registering) takes place. But how could such a script alter one of a user's environmental variables? I use startx on LFS, so environmental variables are set initially by my bash_profile script and then carried over into my GUI. The problem is that, as far as I can determine, there is no retrospective way to alter any of them. The only thing I can think of right now is a wrapper for xscanimage that would read the current scanner address from a system file (maintained by udevd) and reset SANE_DEFAULT_SCANNER if it has changed.

Anyone got a better idea?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Latest scanner Canon CanoScan LiDE 220 dles lton Ubuntu 17.10 Smarties Ubuntu 6 11-13-2017 03:16 AM
[SOLVED] Image "corruption" with CanoScan LiDE 200 scanner Dysprosium Linux - Hardware 5 02-21-2016 04:14 AM
LXer: How to Get an Canon CanoScan LiDE 100 Scanner to Work in Ubuntu 11.10/Linux Mint 12 LXer Syndicated Linux News 0 02-14-2012 03:40 AM
CanoScan Lide 110 (Flatbed Scanner) - Two Issues I need help with tcd1971 Linux - Hardware 2 01-13-2011 10:10 PM
Canoscan LiDE 35 riseringseeker Linux - Hardware 1 10-05-2008 10:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration