1Plustek-USB.txt (2005-08-08) Gerhard Jäger <gerhard@gjaeger.de> 2=============================================================== 3 4NOTE: 5----- 6 7ALL YOU NEED TO RUN YOUR USB SCANNER IS ALREADY INCLUDED. 8 9List of all currently implemented devices 10----------------------------------------- 11 12Quite a lot of them are not tested or even identified. Please send me the ids 13of your device... 14 15 16PLUSTEK 17======= 18Vendor ID: 0x07B3 19 20Product ID Device-description and status 210x0005 not identified yet 220x0007 not identified yet 230x000F not identified yet 240x0010 U12 - working 250x0011 U24 (LM9831) - working 260x0012 not identified yet 270x0013 UT12 (LM9831) - working 280x0014 not identified yet 290x0015 U24 (LM9832) - working 300x0016 not identified yet 310x0017 UT12 - working, UT16 - working, UT24 - working 32 33MUSTEK 34====== 35BearPaw vendor ID: 0x0400 (They use the NationalSemiconductors ID!!!) 36 37Product ID Device-description and status 380x1000 BearPaw 1200 (LM9831) - working 390x1001 BearPaw 1200 (LM9832) - not tested 400x1001 BearPaw 2400 (LM9832) - mostly working 41 42KYE (Genius) 43============ 44Vendor ID: 0x0458 45 46Product ID Device-description and status 470x2007 ColorPage-HR6 V2 - working 480x2008 ColorPage-HR6 V2 - not tested 490x2009 ColorPage-HR6A - not tested 500x2013 ColorPage-HR7 - working 510x2015 ColorPage-HR7LE - not tested 520x2016 ColorPage-HR6X - not tested 53 54Hewlett Packard 55=============== 56Vendor ID: 0x03F0 57 58Product ID Device-description and status 590x0505 HP Scanjet 2100c - working 600x0605 HP Scanjet 2200c - working 61 62EPSON 63===== 64Vendor ID: 0x04b8 65 66Product ID Device-description and status 670x010F EPSON Perfection 1250/Photo - working 680x011D EPSON Perfection 1260/Photo - working 69 70UMAX 71==== 72Vendor ID: 0x1606 73 74Product ID Device-description and status 750x0050 UMAX 3400 - working 760x0060 UMAX 3400/3450 - working 770x0160 UMAX 5400 - working 78 79COMPAQ 80====== 81Vendor ID: 0x049F 82 83Product ID Device-description and status 840x001A S4-100 - working, identical with UMAX 3400 85 86CANON 87===== 88Vendor ID: 0x04A9 89 90Product ID Device-description and status 910x???? FB620U - not integrated 920x2206 N650U - working 930x2207 N1220U - working 940x2208 D660U - working 950x220D N670U/LiDE20 - working 960x2220 LiDE25 - working 970x220E N1240U/LiDE30 - working 98 99 100How to use and configure the Plustek USB backend 101------------------------------------------------ 102 103Please note, that the following is only needed, if you need to upgrade 104a SANE version... 105 106 107Preparations 108------------ 109 110What do we need ? 111 112a SANE backends archive (i.e. sane-backends-1.0.9.tar.gz) 113a driver archive (i.e. plustek-sane-0.45-1.tar.gz) 114 115The latest SANE archive can be obtained at: 116http://www.sane-project.org 117and the latest backend at: 118http://www.gjaeger.de/scanner/plustek.html 119 120Assumptions 121----------- 122 123Our starting point is your home-directory: 124 125:~> 126 127The packages (here sane-backends-1.0.9.tar.gz und plustek-sane-0.45-1.tar.gz) 128are in the /tmp directory. 129 130Let's go: 131--------- 132 133Change to your home directory and create a sane directory 134cd ~ 135mkdir sane 136 137unpack your sane tar-ball (here "sane-backends-1.0.9.tar.gz") 138to this "sane" directory 139 140cd sane 141tar xvzf /tmp/sane-backends-1.0.9.tar.gz 142 143Now unpack your plustek-sane tarball (here "plustek-sane-0.45-1.tar.gz") 144to the backends directory: 145 146cd sane-backends-1.0.9 147tar xvzf /tmp/plustek-sane-0.45-1.tar.gz 148 149Now do the ./configure step... 150Especially for SuSE with a preinstalled SANE-RPM: 151./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --infodir=/usr/share/info 152 153Then do the make step and after that as root user perform the make install 154step. 155 156That's all! 157 158Before using, make sure that the USB scanner device driver is loaded: 159modprobe scanner 160or 161modprobe scanner vendor=0x7b3 product=0x17 162 163You might need to add the following line to /etc/modules.conf, if the scanner is not 164supported directly - vendor and product must match your device! 165options scanner vendor=0x7b3 product=0x17 166 167If you're not sure about the vendor and product id of your device, simply load 168the USB subsystem and plug in your scanner. Then do a 169cat /proc/bus/usb/devices 170and look for the scanner 171 172Now you have to configure the backend. Edit the file /etc/sane.d/plustek.conf 173and fill in the appropriate vendor and product id (see there for examples) 174 175This is it... 176 177 178Autoloading scanner.o 179--------------------- 180 181To perform an automatic load of the scanner module, you might add the modprobe 182line to your boot.local file. 183i.e. on SuSE system > 7.x 184/etc/init.d/boot.local 185An alternative way is to use the hotplug utilities. 186 187 188Using hotplug utilities and libusb 189---------------------------------- 190 191When using libusb with SANE, then you should also use the hotplug utilities to 192automatically setup your device nodes (at least the permissions) and prevent 193scanner.o from loading. 194 195Assuming, that these utilities are properly installed on your box, you have 196to tweak and add some files. 197 198In directory (where of course the config files reside): 199/etc/hotplug 200 201Append the line 202scanner 203to file 204blacklist 205 206This prevents the scanner module from the usb-subsystem to be loaded. 207 208Next thing is to add a new line in 209usb.usermap: 210 211usbscanner 0x0003 0x1606 0x0160 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00 000000 212 213The example line shows the vendor ID of UMAX 0x1606 and the product ID of the 5400 2140x0160 - these values must match the ones of your scanner. 215 216Last step is adding a script in 217/etc/hotplug/usb/ 218It is called "usbscanner" (don't forget the executable rights) 219 220------------------------------------------------- 221# !/bin/bash 222 223if [ "${ACTION}" = add ] && [ -f "${DEVICE}" ] 224then 225 chgrp users "${DEVICE}" 226 chmod ug+rw "${DEVICE}" 227fi 228------------------------------------------------- 229 230This script will correct the access right to your scanner device when the device 231is plugged in. 232 233 234Debugging your USB scanner (written by Kev Green) 235------------------------------------------------- 236 237Firstly, are you running the latest version of SANE, and the Plustek USB driver? 238 239Double check at http://www.gjaeger.de/scanner/plustek.html 240(Plustek USB driver) and http://www.sane-project.org (SANE Suite) to 241make sure you are. 242 243Now, in order to test and utilise your scanner with the Scanner Access Now Easy 244(SANE) system, there are basically two programs that you will need to use from 245the sane-frontends (versions post 1.0.3) or sane (versions pre 1.0.3) packages. 246 247Firstly, the sane-find-scanner program will allow you to locate your scanner, 248and help you work out if sane knows where it is. This is not definite however, 249as (you'll see this too when using sane-find-scanner) it will find all the 250scanners on your USB and SCSI bus, whereas sane will only work when you have 251the relevant sane backend installed and configured correctly for the relevant 252scanner. 253 254So, if sane-find-scanner can find your scanner, but scanimage doesn't work, 255then you need to check, double check, and even triple-check your SANE 256configuration file for plustek scanners (plustek.conf, usually in 257/etc/sane.d 258or maybe in /usr/local/sane/ or somewhere, a "find" will be able to tell you 259where. It may take a while though!). 260 261If sane-find-scanner doesn't find your scanner, then you should check to see if 262the kernel recognises it at all, which you can do with the following command, 263as mentioned above: 264 265cat /proc/bus/usb/devices 266 267If your scanner doesn't appear in there, then the kernel has not recognised it. 268There may however be a crypic-looking entry in there which doesn't name itself 269as plustek, in which case it is recognised as being there by the kernel, but is 270not know to the kernel's USB device database, in which case this should be 271mentioned on the plustek list (<plustek@linuxhacker.org>), from where 272the "powers that be" will deal with it. 273 274If that file does not exist in the /proc filesystem, then you don't have the 275"Preliminary USB filesystem" option set in your kernel, and you will need to 276recompile your kernel to allow you to do this step in debugging. If it 277exists, but is empty, you will have to make sure (use the kernel configure 278help information and the details of your motherboard to ascertain this!) 279you have the right one of UHCI or OHCI USB modules installed or compiled into 280your kernel. 281 282Once you've established that the kernel has recognised your scanner, you can 283start pointing the finger at SANE, or simply the "scanner" module. You will 284need to have selected the "USB Scanner" option in your kernel compilation as 285a module, or compiled into the kernel. If you have done neither, then SANE will 286simply not be able to recognise your scanner. Rectify that, if you are missing 287it. 288 289If you have carried out all of the above steps, then sane-find-scanner should 290be able to recognise your scanner correctly. 291 292sane-find-scanner probes all of the devices on the SCSI and USB buses, and 293so you may find that it outputs "unable to get minor data" errors or similar 294to your terminal, or to your error logs, you can safely ignore these as long 295as it does that, and has recognised your scanner. 296 297Once you have found your scanner okay using sane-find-scanner, then you are 298ready to start messing around with the actual scanimage program to attempt 299to scan an image in. 300 301Obviously (although this may turn out to be premature) you should now have 302something in your scanner ready to scan for verification. 303 304At this stage, you should begin to be warey, because while the USB stuff for 305Plustek scanners is in development it may (like any kernel/module related software) 306crash your system with a kernel panic, or simply just segfault, so for your own sake, 307close down all the applications you are running and ONLY use text console, rather 308than X-Windows at this point, as you will certainly want to avoid any 309potential filesystem corruption. 310 311At this point it's probably also good to ensure that you have selected the 312"Magic SysRq Key" option in the kernel hacking section of the kernel config, 313and done: 314 315echo 1 > /proc/sys/kernel/sysrq 316 317And of course read the readme for that in /usr/src/linux/Documentation, as that 318should allow you to avoid filesystem corruption during any crashes that might 319happen. 320 321Now, before running scanimage, you should enable the maximum levels of 322debugging possible in both the SANE core and in the Plustek scanner 323backend. 324 325To do this you should do: 326 327export SANE_DEBUG_PLUSTEK=12 328export SANE_DEBUG_DLL=12 329 330Now, if you run scanimage, you should be able to see the maximum debugging 331messages. 332 333If those messages don't tell you what is wrong, then take note of your scanner 334type, the contents of /proc/bus/usb/devices, and the contents of your error 335log, as well as (where possible) the output of the scanimage command (if 336you can't capture it directly, an as-accurate-as-possible description is 337MUCH better than nothing!), and try and get all of the activity that 338your scanner did as well (light 339came on? didn't? motors came on? etc?) and email that to the plustek list 340(<plustek@linuxhacker.org>). 341 342For the particularly adventurous only... 343 344You might want to try running the scanimage program through strace or 345gdb to see if you can go some or all of the way to debugging the problem 346yourself, and post the relevant (ie. last!) parts of those utilities 347output to the plustek-help list. If you don't know what strace or gdb 348are, then you should probably not try that. 349 350It's probably safe to run your scanner in a normal operating environment 351under Linux once you have got it working once in a text console. 352 353 354How to add a new LM9831/2 based device description 355-------------------------------------------------- 356 357If you have a LM9831 or LM9832 based scanner and your vendor and product id did 358not appear in the list above and you're willing to do some experiments, then 359simply add your device to the file plustek-devs.c at the end of the list. 360See the list at the end of the file how this works... 361 362 363Thanx guys for helping: 364----------------------- 365 366Henning Meier-Geinitz henning@meier-geinitz.de for Mustek Bearpaw testing, ideas and patches 367Stefan Nilsen stefan.nilsen@telia.com for HP2200c testing and patches 368Kev Green kyrian@ore.org for Documentation, UT12 testing and RPMS. 369Holger Bischof bischof@cs.tu-berlin.de for OpticPro U12 testing 370Abhijit Sovakar a.sovakar@gmx.de for OpticPro UT24 testing 371Peter Koellner peter@mezzo.net for OpticPro U24 testing 372Gene Heskett gene_heskett@iolinc.net for EPSON 1250 testing and patches 373Tasnim Ahmed tasnim_ahmed@yahoo.com for KYE Colorpage HR6 testing 374Reinhard Max max@suse.de for EPSON 1250 testing and patches 375Allan N. Hessenflow allan@kallisti.com for UMAX 3400 testing and patches 376Craig Smoothey craig@smoothey.org for HP2100c testing and patches 377Till Kamppeter till.kamppeter@gmx.net for EPSON1260 testing 378Christopher Montgomery monty@xiph.org for CanoScan calibration works 379Olaf Leidinger leidola@newcon.de for CanoScan LiDE25 testing 380 381and a lot of other guys not named here... 382 383 384Some equations which are used to calculate some stuff 385----------------------------------------------------- 386 387The stuff is used in plustek_usbscan.c to get the correct register settings 388out of the hardware descriptions: 389 390Crystalfrequency is 48MHz 391 392 393Pixel Period (seconds/pixel) 394---------------------------- 395 396 MCLK_DIV x 8 x CM 397PixelPeriod = ----------------- 398 48MHz 399 400 401Integration Time (seconds) 402-------------------------- 403 404Tint = PixelPeriod X LineLength 405 406 MCLK_DIV x 8 x CM X LineLength 407Tint = ------------------------------ 408 48MHz 409 410 411Ideal MCLK Divider 412------------------ 413 48MHz (DataPixelsEnd - DataPixelStart) 414MCLK_DIV = --------------------------- x -------------------------------- 415 HostIORate x 8 x LineLength HDPI_ADJ x PP 416 417 48MHz (DataPixelsEnd - DataPixelStart) CM 418 = ------------------------------- x -------------------------------- x ---- 419 BytesPerSecond x 8 x LineLength HDPI_ADJ x PP CM 420 421 48MHz 1 422 = --------------------------- x Tint x --------- 423 8 x LineLength CM 424 425 48MHz (Tint * 1000) 426 = ----------------------- x -------------------- 427 1000 x 8 x LineLength CM 428 429 430Ideal Scan Speed (inches/second) 431 432 1 1 1 433ScanSpeed = ----------- x -------- x -------- 434 PixelPeriod FSPI x 4 StepSize 435 436 48MHz 1 1 437ScanSpeed = ----------------- x -------- x -------- 438 MCLK_DIV x 8 x CM FSPI x 4 StepSize 439 440 441 48MHz 442MCLK_DIV = ------------------------------------------ 443 ScanSpeed x 8 x CM x FSPI x 4 x StepSize 444 445 446 447---------------- 448Symbols: 449 450CM - Color Mode (unitless), 3 for channel pixel rate color, else 1 451 452 453------------------------- 454