Wednesday, July 2, 2014

Xubuntu network sharing Samsung USB scanner

Another one down.

I have an intransigent SAMSUNG SCX-4x21 Series multifunction printer scanner that someone gave us. I'd have gone for the network version, but beggars can't be choosers.

Anyway, I thought I'd try and network the scanner to the other workstations.

I first tried it by setting up saned. This was a major fail. If I accessed the scanner with scanimage -L I got a big error.

Ironically if I started saned in manual mode with /usr/sbin/saned -d128 it worked OK from a networked workstation.

Seems that there is an issue with Samsung scanners and sane to do with error messages. There are various posts around about this including on the sane FAQ list.

Solution is to use a wrapper :

On 'server' where the USB printer/scanner is connected :


edit /etc/defaults/saned and set RUN = NO


Install xinetd (I know it is deprecated but by the time it's dumped entirely I'll have moved on....)

sudo apt-get install xinetd

Configure /etc/xinetd.conf  (amend your network details accordingly)

# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{
# add your network here
only_from = 10.0.0.0/24
instances = 60
log_type = FILE /var/log/xinetd.log
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}

includedir /etc/xinetd.d




Make new file in /etc/xinetd.d/saned with the following :


service saned
{
  port        = 6566
  protocol    = tcp
  disable     = no
  flags       = REUSE
  socket_type = stream
  wait        = no
  user        = root
  group       = saned
  server      = /usr/sbin/saned_wrapper
}




Make a new file called /usr/sbin/saned_wrapper with the following :

#!/bin/sh
#
# Need this for Samsung Scanners
# Put in in /usr/sbin and chmod 755 /usr/sbin/saned_wrapper
#
# Call saned with stderr redirected, to avoid strange crash
exec /usr/sbin/saned 2> /var/log/saned.log



sudo service xinetd restart

On the remote workstation make sure you add the IP address of the 'server' to /etc/saned.d/net.conf

Try connecting from a remote workstation with scanimage -L

Get a coffee and relax :-)

No comments:

Post a Comment