Bug 113737 - No Scanner?
Summary: No Scanner?
Status: RESOLVED WONTFIX
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Installation (show other bugs)
Version: RC 1
Hardware: Other All
: P5 - None : Normal
Target Milestone: ---
Assignee: Hannes Reinecke
QA Contact: Klaus Kämpf
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-29 06:53 UTC by Joachim Reichelt
Modified: 2005-09-29 13:42 UTC (History)
1 user (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
YaST2 log of installation (267.20 KB, application/x-compressed-tar)
2005-08-31 06:17 UTC, Joachim Reichelt
Details
My hardware (273.96 KB, text/plain)
2005-08-31 06:18 UTC, Joachim Reichelt
Details
My hardware (273.96 KB, text/plain)
2005-08-31 06:18 UTC, Joachim Reichelt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Reichelt 2005-08-29 06:53:16 UTC
Installation does not check for scanners.

If I use YAST to add a scsi scanner, no scanner is found.
Reason: sg not loaded
I have to
modprobe sg and then restart scanner config in yast.
And
yast could check for the loged in user and change the owner of the related /dev/sg?

Cannot remove scanner, if the scanner is not accessible (any more)
Comment 1 Arvin Schnell 2005-08-30 09:45:26 UTC
Please provide YaST2 log of installation, see:
http://www.opensuse.org/index.php/Bug_Reporting_FAQ#YaST
Comment 2 Joachim Reichelt 2005-08-31 06:17:43 UTC
Created attachment 48257 [details]
YaST2 log of installation
Comment 3 Joachim Reichelt 2005-08-31 06:18:23 UTC
Created attachment 48258 [details]
My hardware
Comment 4 Joachim Reichelt 2005-08-31 06:18:59 UTC
Created attachment 48259 [details]
My hardware
Comment 5 Joachim Reichelt 2005-08-31 06:19:47 UTC
Sorry<, used the backbutton :-;
Comment 6 Johannes Meixner 2005-08-31 08:32:06 UTC
YaST doesn't do module loading.
This should be done automatically by udev/hotplug
when a SCSI host adapter is found.
Comment 7 Johannes Meixner 2005-08-31 08:49:40 UTC
Joachim,
regarding "yast could check for the loged in user and change the
owner of the related /dev/sg?":
"check for the loged in user" doesn't make sense because YaST runs as root.
But the rest is done by YaST provided YaST (i.e. "scanimage -L") can
find the scanner: Then /etc/init.d/sane-dev is activated.
Comment 8 Klaus Kämpf 2005-08-31 08:54:22 UTC
"yast could check for the loged in user and change the 
owner of the related /dev/sg?" 
 
That would be wrong. Device ownerships is set during login based on the groups 
the user belongs to. We have e.g. "video", "dialout", "audio", etc. 
So if we need special rights for special devices, there is login.devperms to 
adapt this. 
Comment 14 Joachim Reichelt 2005-08-31 11:02:25 UTC
The problem arises, when i run KDE, su, started yast and configured the scanner.
In this case, owner of (scsi-)scanner is root:disk
Ownerchip is changed only durin login/start kde.
I did not want to relogin to kde.
Comment 15 Johannes Meixner 2005-08-31 11:58:32 UTC
Christian,
very many thanks for the solution!


Joachim,
in beta3 the udev package has a bug.
To fix it (at least regarding the generic SCSI access) change
/etc/udev/rules.d/50-udev.rules as follows:

Append the line
-------------------------------------------------------------------
SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg"
-------------------------------------------------------------------
to the "# block devices" section.

Then reboot.

During boot a module for your SCSI host adapter should be loaded
(this should have happened even before the udev change)
and because of the new udev rule the "sg" module will be loaded too
so that directly after boot "sane-find-scanner" will find your
scanner if you run it as root (because at this moment only root
has access to the /dev/sg* generic SCSI device nodes).

Then run the YaST scanner config and everything should be set up
properly. In particular YaST should set up the SCSI permissions
by running and activating /etc/init.d/sane-dev so that directly
after finishing the YaST scanner config any normal user should have
access for the scanner's SCSI device node (and only for this node).

Then reboot again to verify that sane-dev runs during boot.
You should get a boot message like
-----------------------------------------------------------------
Searching for configured scanners in SANE........
Setting scanner access mode to rw-rw-rw- for
/dev/sg0 done
-----------------------------------------------------------------
where /dev/sg* must be exactly the scanner's generic SCSI
device node on your particular system.

Joachim,
please report if it works for you.
Comment 16 Joachim Reichelt 2005-09-01 06:42:19 UTC
It fixes the modprobe problem.
So I did some ad on tests.

from /proc/scsi I got 
# cat /proc/scsi/sg/allow_dio
0
# cat /proc/scsi/sg/debug
dev_max(currently)=32 max_active_device=9 (origin 1)
 def_reserved_size=32768
cat /proc/scsi/sg/def_reserved_size
32768
# cat /proc/scsi/sg/device_hdr
host	chan	id	lun	type	opens	qdepth	busy	online
# cat /proc/scsi/sg/device_strs
EPSON   	SCANNER GT-7000 	1.09
SEAGATE 	ST373405LW      	0003
SEAGATE 	ST373405LW      	0003
Maxtor  	1394 storage    	v1.3
ST325082	3A              	    
Generic 	              CF	1.6E
Generic 	              MS	1.6E
Generic 	          MMC/SD	1.6E
Generic 	              SM	1.6E
# cat /proc/scsi/sg/devices
0	0	6	0	3	1	2	0	1
0	0	8	0	0	1	32	0	1
0	0	9	0	0	1	32	0	1
1	0	0	0	0	1	8	0	1
2	0	0	0	0	1	8	0	1
3	0	0	0	0	1	1	0	1
3	0	0	1	0	1	1	0	1
3	0	0	2	0	1	1	0	1
3	0	0	3	0	1	1	0	1
##  Meaning
host_no
	scsidp->channel,
		scsidp->id
			scsidp->lun
				scsidp->type
					1
						scsidp->queue_depth
							scsidp->device_busy
								scsi_device_online(scsidp))
## So scsidp->type == 3 is (here) the sacnner
# cat /proc/scsi/sg/version
30533	3.5.33 [20050328]

## in /etc/udev/rules.d/50-udev.rules
...
SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[345]",
RUN+="/sbin/modprobe sr_mod"
## Test Bug 113737
##
SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg"
...

## Tried with success:
SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="3",
RUN+="/sbin/modprobe sg"



So can I change here the protection of this device to 666?
Comment 17 Joachim Reichelt 2005-09-02 09:08:30 UTC
Scanner works in Beta4.
But:
If I switch on the scanner not at boot, but just before usage and run
rescan_scsi_bus, I get all neded drivers, but the scanner is 640 root:disk.
Is there a way to change the 640 protection to 666 in udev??
Comment 18 Johannes Meixner 2005-09-02 09:43:43 UTC
There is neither a SCSI device class nor a USB device class for scanners.
Both SCSI and USB scanners show up as more or less random or unspecified
devices on the SCSI and USB bus.
For example my SCSI scanner shows up in "lsscsi" as "processor".

Therefore the SANE backend must query the SCSI and USB bus and
compare the device identifiers from the bus with long built-in
lists of device identifiers for those scanners which are supported
by the particular backend.
See
http://portal.suse.com/sdb/en/2004/10/jsmeix_scanner-setup-92.html
"Trouble-Shooting (Debugging)"
how to log what a backend does.

By the way: This is one reason why we don't want to have all
backends enabled (in /etc/sane.d/dll.conf) by default because
then all backends (one after the other) would query the SCSI
and USB bus to look for their scanners.

To determine whether or not a SCSI or USB device is a scanner
you must run the SANE backend.
This is exactly what "scanimage -L" does and why it is called
as "/usr/bin/scanimage -f '%d,'" in /etc/init.d/sane-dev.

If udev would change the device mode for scnners, it would have
to determine whether or not a SCSI or USB device is a scanner
every time when any kind of SCSI or USB device is connected
and/or disconnected.

To see the consequences simply run "scanimage -L" and watch
how long it takes. If it is fast, it takes about 1 second.
But I do have a scanner which needs several seconds to wake up.
Comment 19 Joachim Reichelt 2005-09-02 10:14:25 UTC
O.K.
So I shoud do:
rescan_scsi_bus [controller]
/etc/init.d/sane-dev

to get it allright?
Scanner is (and has tobe) setup once in yast!
Perhaps add a script  like this to /usr/share/doc/sane/
Comment 20 Joachim Reichelt 2005-09-03 20:41:42 UTC
The combination of  
rescan_scsi_bus [controller] 
/etc/init.d/sane-dev 
 
does to trick! 
So I think of creating  a script for normal users to run this. 
Comment 21 Joachim Reichelt 2005-09-27 21:06:45 UTC
In RC1 
Is the scanner switched on during boot, I cannot access it. 
 
jre@joachim:~> l /dev/sg0 
crw-r-----  1 root disk 21, 0 2005-09-28 00:59 /dev/sg0 
jre@joachim:~> cat /var/lib/sane/devices 
/dev/sg0 
jre@joachim:~> 
 
power off scanner 
rescan_scsi_bus -d 
power on scanner 
rescan_scsi_bus 
-> all o.k. 
 
If powered on later and done as in #20: all o.k. 
 
So there is a remaining chmod probem. 
Comment 22 Johannes Meixner 2005-09-29 13:18:46 UTC
If it works as described in comment #20 it is o.k.
We cannot "fix" it.
See the detailed explanation in comment #18.
Comment 23 Joachim Reichelt 2005-09-29 13:42:48 UTC
I will try to fix this problem for my special situation.
I acccnolage, that there is no global solution (at least at now)