el_Salmon
Posts: 17
Joined: Thu Jan 10, 2013 2:22 pm

Scanner disappear after some seconds

Sun Nov 03, 2013 10:26 am

Hi,

I have a multifunction printer & scanner: Samsung CLX-3185. Printing works fine under Raspbian but scanning has a weird issue: it seems that dissapears after some seconds to plug the USB cable in the RPi. When I run:

Code: Select all

$ scanimage -L
device `xerox_mfp:libusb:001:020' is a Samsung Samsung CLX-3180 Series multi-function peripheral
but some seconds after that:

Code: Select all

$ scanimage -L
No scanners were identified. If you were expecting something different,
check that the scanner is plugged in, turned on and detected by the
sane-find-scanner tool (if appropriate). Please read the documentation
which came with this software (README, FAQ, manpages).
When I plug the multifunction device to my laptop, scanimage tool detects the scanner without problems. What's happening?

User avatar
DougieLawson
Posts: 36322
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Scanner disappear after some seconds

Sun Nov 03, 2013 11:09 am

Are you connecting it to a powered USB hub?
It probably needs more than 100mA so needs to be on a powered hub.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

el_Salmon
Posts: 17
Joined: Thu Jan 10, 2013 2:22 pm

Re: Scanner disappear after some seconds

Sun Nov 03, 2013 11:24 am

I have tried in two ways: connected to the RPi USB port and connected to a powered 4-port USB hub, but the issue keeps. The problem with USB hub is noted in the FAQ about Samsung drivers:
If you enter "sane-find-scanner" in a terminal and do get output indicating that your computer "sees" your scanner, but xsane or "scanimage -L" or similar programs do not recognize the scanner, you can try the following:

Ensure your printer/scanner is connected to a main (usually powered) USB port, not a hub or secondary port. This is most often a problem with external hubs or monitor ports, but occasionally it happens even when connecting directly to a computer. If this is the problem, printing will usually work fine, but scanning will fail.

makaro
Posts: 1
Joined: Mon Mar 02, 2015 1:16 pm

Re: Scanner disappear after some seconds

Tue Mar 03, 2015 8:51 am

I had the same problem and I could solve it finally. The problem is that raspbian has a SANE v1.0-22 which does NOT support this printer type while 1.0-24 does. I have found a website giving a solution according to which the Samsung drivers (xerox_mfp backend) of SANE v1.0-24 should be compiled on raspbian and the right .so (i.e. libsane-xerox_mfp.so.1 -> libsane-xerox_mfp.so.1.0.25) should be then linked. Fortunately this v1.0-24 driver can be compiled and functions together with the rest of SANE v1.0-22. Also, the description of compilation is quite straightforward but takes for the RPi some time to accomplish.

Here is the website about compilation:
http://linuxbear.blogspot.hu/2012/12/ca ... linux.html
However you should substitute 'BACKENDS="pixma" ./configure' with 'BACKENDS="xerox_mfp" ./configure' because you need the new xerox_mfp backend and not the pixma.
After the compilation the new libsane-xerox_mfp.so.1.0.25 shared object will be in /usr/local/lib/sane. It should be linked by /usr/lib/arm-linux-gnueabihf/sane/libsane-xerox_mfp.so.1. In addition, you should copy your new
.../sane-backends/backend/xerox_mfp.conf to /etc/sane.d which have the lines:
#Samsung CLX-3180 Series: Samsung CLX 3185
usb 0x04e8 0x343d
and add the following lines to the /lib/udev/rules.d/60-libsane.rules:
# Samsung CLX-3185
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="343d", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes"

After this it should work. It is not certainly the most professional solution and hopefully I did not miss anything here what I have done. Also, let me warn the reader that upgrading SANE may overwrite these changes according to another post somewhere. If this is the case, repeat the above linking and copying steps.
Good luck!

User avatar
EUA
Posts: 5
Joined: Sat Jul 06, 2013 11:21 am

Re: Scanner disappear after some seconds

Sat Feb 11, 2017 3:30 am

I have same issue with
vendor=0x04e8 [Samsung], product=0x3419 [SCX-4x21 Series]

Indeed, problem not related with seconds after boot but after first scanimage call. First call stucks the scanner.

Found the issue in this mail post:
https://lists.alioth.debian.org/piperma ... 32052.html
At the file of xerox_mfp-usb.c:
sanei_usb_clear_halt (dev->dn);
halts the scanner.
Here is the patch file:
xerox_mftp-samsung.patch

Code: Select all

--- backend/xerox_mfp-usb.c.org	2017-02-11 02:41:01.576977688 +0000
+++ backend/xerox_mfp-usb.c	2017-02-11 02:42:32.635546044 +0000
@@ -70,7 +70,7 @@
         dev->dn = -1;
         return status;
     }
-    sanei_usb_clear_halt(dev->dn);
+    //sanei_usb_clear_halt(dev->dn);
     return SANE_STATUS_GOOD;
 }
 
@@ -92,7 +92,7 @@
             ret_cancel(dev, 0);
     }
 
-    sanei_usb_clear_halt(dev->dn);	/* unstall for next users */
+    //sanei_usb_clear_halt(dev->dn);	/* unstall for next users */
     sanei_usb_close(dev->dn);
     dev->dn = -1;
 }

And compilation commands from makaro's post

Code: Select all

apt-get install git
apt-get install pkg-config #this needed for lib-usb detection.
apt-get install autoconf
apt-get install gcc
apt-get install libusb-dev
apt-get install make

git clone git://git.debian.org/sane/sane-backends.git
cd sane-backends/
autoconf ( Squeeze has a older version, then what the git repository used, but it worked)
automake
BACKENDS="xerox_mfp" ./configure --prefix=/usr
patch p0 -i ../xerox_mftp-samsung.patch
make
su ( need to be root, for make install and to run ldconfig)
make install
ldconfig -v 
Check the SamyGO Samsung TV Hacking Community ( http://www.samygo.tv )

Return to “General discussion”