SULDR Forums Supported Printers Printing Questions Scanning Questions General Questions Samsung Installer

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - mak2109

Pages: [1]
1
Scanner Server (Scan to PC) / scan2pc.sh bash script
« on: October 02, 2021, 09:07:47 »
Hi,

I have an Samsung M2070W Printer/Scanner and wished to use the "Scan to PC" functionality with Ubuntu 20.04 LTS like in the Windows environment. So I tried to use the "suld-scantopc_{version}.deb" of this repository and failed getting the python2 dependencies to work. The required dependency packages for python2 are no more available.

In order to still get this functionality, I made a tcpdump and analyzed the communication between scanner and windows driver. As a result I wrote a bash script, that does the job. The script is attached to this post.

As a prerequisit you should habe installed the (s)uld driver and sane environment to be able to do a normal (e.g. xsane) scan controlled by the Linux-PC. In addition the script requires the folowing programs (packages):
   package:        program
   --------------   ---------------
   bash:             bash, wget, grep, sed
   sane-utils:      scanimage
   imagemagick: convert
   snmp:            snmpget
   poppler-utils:  pdfunite
   libtiff-tools:     tiffcp
The configuration data are "stored" as shell variables or given as parameters ($1 .. $4) when you execute the script. The script has a timeout value of 600 secs (10 minutes) before it terminates (or is killed by the user typing ctrl-c (^C)).
After starting the scrip you have 10 minutes time to walk to the scanner and press the known buttons.
As I could not yet completely figure out the logic of the "1b a8" protocol that manages the dialog (next scan: yes/no) at the scanner, the scan cycle is terminated after scanning one page. To be able to do a multi-page scan you have to select "multi PDF" or "multi TIFF" except for the last page. The last page has to be scanned with "single PDF" or "single TIFF" selection at the scanner display (sorry for this inconveniance).

You can get some logging information, if you set "$ export SCANNER_DBG=true" or enable script tracing via "$ set -x". The SCANNER_DBG flag can be set too as the 4th parameter e.g.
                      $1   $2                   $3                             $4
   $ . scan2pc "./" "192.168.1.99" "A4,M_PDF,MONO,200" true

If you have not set any script variable ($ export) and entered no parameter the defaults are:
   $1 - active directory (./)
   $2 - IP of the samsung scanner is called via "scanimage -L" (1st samsung scanner)
   $3 - DIN-A4 page (A4), multi PDF scan (M_PDF), Color {COLOR|GRAY|MONO} (MONO)
   $4 - debug flag {true|false} (false)
   
After you have selected a single scan (e.g. S_PDF), the previously scanned M_PDF pages plus the last S_PDF page are merged to one multi-page document. So after the S_PDF scan you can start a new mult-page scan using M_PDF.

Pages: [1]
Repository Information Legal Contact Alternative Drivers