1This is a report on how to build SANE on Solaris/x86 using a USB scanner. See
2below for SCSI.
3
4Another report for SANE on OpenSolaris can be found here:
5http://ginfo.egim-mrs.fr/article.php3?id_article=44
6
7From: Tomasz Orlinski <tomasz.orlinski@wp.pl>
8To: sane-devel@lists.alioth.debian.org
9Subject: [sane-devel] USB scanners DO work on Solaris 10 x86
10Date: Thu, 7 Oct 2004 20:26:50 +0200
11
12I would like to inform you, that I have compiled SANE on Sun Solaris 10 x86
13with built-in USB scanner support. It was possible, because Sun had prepared
14libusb library wrapper for Solaris 10. I know, that Solaris 10 Software
15Express Release 08/04 is required. I have done it in that way:
16LD_LIBRARY_PATH=/usr/sfw/lib:$LD_LIBRARY_PATH
17CFLAGS="-I/usr/sfw/include"
18CPPFLAGS="-I/usr/sfw/include"
19LDFLAGS="-L/usr/sfw/lib -R/usr/sfw/lib -lusb"
20export LD_LIBRARY_PATH CFLAGS CPPFLAGS LDFLAGS
21./configure --prefix=/opt/sane --disable-fork-process
22make
23make install
24It was also required to add a generic USB kernel driver. I had to look for
25my scanner device name in output of
26prtconf -D -v
27command. My scanner is Plustek UT24 and the appropriate part of output looked
28like this:
29name='compatible' type=string items=8 value='usb7b3,17.100' + ...
30I had to remove the not used kernel driver
31rem_drv ugen
32And add it again:
33add_drv -i 'usb7b3,17.100' ugen
34Then, /opt/sane/bin/sane-find-scanner detected my scanner and everything
35worked fine. I to add " " signs around usb7b3,17.100 name in
36/etc/driver_aliases to have the scanner working after reboot.
37To compile this packages SUNWlibusb and SUNWlibusbugen were needed. I used
38Solaris Software Companion CD gcc 2.95.3 compiler and Sun's /usr/ccs/bin/ld
39linker. USB support DOES NOT work in Solaris 9 and earlier versions.
40I hope, that this information would be useful for other USB scanner users.
41
42From: Tomasz Orlinski <tomasz.orlinski@wp.pl>
43To: sane-devel@lists.alioth.debian.org
44Subject: Re: [sane-devel] USB scanners DO work on Solaris 10 x86
45Date: Fri, 8 Oct 2004 16:06:14 +0200
46
47[...]
48
49Sun in Driver Development Kit v. 0.9 writes how to compile SANE, but it does not
50really work :) They write about compiling with gcc and give options for Sun
51Forte compiler (cc) and forget about attaching a kernel driver. But they write,
52that versions earlier than 1.0.14 cannot be used. They want also to build SANE
53with Posix threads enabled. So I think that can be true. Sun writes also, that
54Solaris Software Express release at least S10_62 is needed to use
55libusb. Release number can be checked in /etc/release. The newest version can be
56downloaded from www.sun.com/solaris for free.
57
58In my opinion it is important to be cautious when using scanner or just libusb
59on important Solaris machines (especially multi-processor ones), because unlike
60in other systems, Solaris kernel is fully preemtible, what means, that many
61instances of the same driver can run simultaneously - it's dangerous, when
62drivers are not perfect. And Solaris USB framework is absolutely new, so it can
63contain bugs. I tried to crash my Solaris using USB subsystem and SANE, I didn't
64manage to, but it doesn't mean, it's impossible.
65
66SANE frontends work without any problems with Xsun and GIMP included in Solaris
67Software Companion CD.
68
69---------------------------------------------------------------------------
70The following text describes, how to use a SCSI scanner (2002-06-11).
71
72You need a generic SCSI driver to run SANE on Solaris.  There are at
73least three such drivers: the scg driver by Joerg Schillig, the
74sg driver by Kevin Sheehan, and starting with Solaris 8 Sun's own
75sgen(7D) driver.
76
77NOTE: You should install the SCSI generic driver BEFORE you run
78`configure' in the sane directory---otherwise configure won't set up
79SANE to work with the generic scsi driver.
80
81*** scg driver
82
83The SCSI general driver scg is
84
85	Copyright 1986-1995 Joerg Schilling,
86
87It is supplied binary in pkgadd(1m) format and is tested from Solaris
882.3 to Solaris 2.6 (sparc) and Solaris 2.3 to Solaris 2.5.1 (x86).  It
89can be found in
90
91	ftp://ftp.fokus.gmd.de/pub/unix/kernel/scg/
92
93To install it on a SPARC do:
94
95	cd /tmp
96	get SCHILYscg.sparc.tar.Z
97	uncompress SCHILYscg.sparc.tar.Z
98	tar -xvf SCHILYscg.sparc.tar
99as root:
100	pkgadd -d .
101
102NOTE: Be very careful with pkgadd as it does not check for the correct
103      target architecture. Do not install drivers for x86 on sparc
104      and vice versa.  You will get a corrupt system otherwise.
105
106For Solaris on an x86 do:
107
108	cd /tmp
109	get SCHILYscg.i386.tar.Z
110	uncompress SCHILYscg.i386.tar.Z
111	tar -xvf SCHILYscg.i386.tar
112as root:
113	pkgadd -d .
114
115Then do a reboot --r
116
117Once the system has rebooted, there should be a device node /dev/scgXX
118for each of your SCSI adapters (/dev/scg0 for the first adapter,
119/dev/scg1 for the second, and so on...)
120
121Because the device name specifies a SCSI adapter, you need to use a
122special device naming syntax so SANE can tell which device you want to
123talk to.  If the device is at SCSI id 0, the character 'a' should be
124appended, character 'b' should be used for SCSI id 1, and so on
125(see also the Solaris section in sane-scsi(5)).
126
127E.g., to configure an HP scanner, configuration file
128/opt/local/etc/sane.d/hp.conf might contain:
129
130	/dev/scg0c	if the scanner has the SCSI target id 2
131
132WARNING! Everybody who can read/write a generic SCSI device can do
133with all your disks whatever he/she wants. It takes only a few lines
134of code to send a FORMAT control block...  Rather than giving users
135access to the SCSI adapter special device, it may be a better idea to
136install scanimage/xscanimage setgid to a special "scanner" group and
137then turn on write permission for the scanner group.
138
139*** sg driver
140
141Another solution to the permission problem is to use the generic SCSI
142driver sg by Kevin Sheehan.  This driver is not free but uses separate
143device node for each SCSI target:
144
145	/dev/sg/0, /dev/sg/1, ...
146
147This allows to control device access on a per-device basis.
148
149*** sgen driver
150
151The solaris 8 sgen driver must be configured before it can be used.
152See /kernel/drv/sgen.conf and the manual page sgen(7D).
153
154The minimal config includes defining the correct
155"device-type-config-list" property in /kernel/drv/sgen.conf.  The
156typical SCSI device type for a scanner is either "scanner" or
157"processor". You can optionally restrict the devices sgen attaches to,
158by defining the "inquiry-config-list" property.  You also have to
159uncomment the scanner's "target/lun" entry, so that the sgen driver is
160allowed to attach to the SCSI scanner hardware.
161
162After the configuration file /kernel/drv/sgen.conf is set up for the
163scanner, run the command "devfsadm -v -i sgen" to create sgen device
164nodes for the scanner.  In case you need to rerun devfsadm to
165incorporate changes to the sgen.conf file, make sure the sgen driver
166is unloaded from the kernel before you re-run devfsadm.  The driver is
167unloaded using the "modunload -i {id}" command; the {id} of the sgen
168driver can be determined with the modinfo command.
169
170
171The device nodes use names of the following form:
172
173	/dev/scsi/device-type/cXtXdX
174
175Example:  A HP Scanjet 4c (SCSI device type: "processor") on controller
176#1, target #6, lun #0 uses the device name
177
178	/dev/scsi/processor/c1t6d0
179
180/kernel/drv/sgen.conf contains:
181
182	device-type-config-list="processor";
183	name="sgen" class="scsi" target=6 lun=0;
184
185
186
187If you have questions or problems with the Solaris support in SANE,
188send mail to:
189
190     hu@garfield.m.isar.de
191