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

Author Topic: Scan to PC in Linux (Development)  (Read 42377 times)

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Scan to PC in Linux (Development)
« on: December 20, 2012, 07:00:41 AM »
Hi,

I wanted to make usage of the "scan to PC" option of my Samsung CLX 3300 in order to save documents to my local Linux server. This way I would not have to turn on the computer just to trigger the scan.

Unfortunately the Samsung Unified Linux Driver does not support this feature so I created my own implementation after doing a reverse engineering of the messages sent by the windows version. My implementation uses python and sane and allows defining several configuration setups. The code is still very primitive (I just finished getting it working) so the following things are missing:

* PDFs and TIFFs get a file/page, even if you select M_PDF or M_TIFF
* create debian package
* add image enhancements (the Python PIL include several but I did not try them yet)

Enjoy and let me know if it works for you or you have patches to improve it.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #1 on: December 20, 2012, 12:39:57 PM »
Thanks for sharing.  If this proves of interest to others, and any configuration is moved out of the script itself into a config file, I could probably package and distribute it.

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #2 on: December 20, 2012, 04:06:05 PM »
All the configuration is at the begining of the script so it would be easy to move it to an extra file under /etc. Any preferences?

The script would also need an upstart config file and, potentially, a logrotate one as well.

At the moment what it is anoying me is that Sane is slow with the Samsung devices conpared to scanning from Windows: it takes 45 second to scan a page in "Grayscale - 256 Levels" and 300 dpis while Windows or scanning to a USB memory plugged into the scanner only takes 15. My theory based on the number and size of the packages in my network capture is that the Windows driver is able to tell the scanner to scan and transfer the image already compressed in JPEG format. In Sane I only found support for PNM and TIFF...

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #3 on: December 20, 2012, 10:44:08 PM »
All the configuration is at the begining of the script so it would be easy to move it to an extra file under /etc. Any preferences?
No, anything uniquely identifying works for me.

The script would also need an upstart config file and, potentially, a logrotate one as well.
For compatibility, I use old-style init scripts for packages that need them; that way they can be used with any of the various startup routines, and upstart (or whatever) can deal with it on the fly.  This is simple for me to implement.  I haven't looked at your script closely enough to see if it is generating enough output to justify a logrotate, but feel free to include that if you think it might be necessary.

I am unlikely to do anything with packaging for at least the next two weeks, although I hope to spend some time on it at some point in January.  (I'm really hoping Samsung releases a new driver right before then, but they seem to have a habit of doing that right after I go through an update round.)  So from my point of view, there is no urgency on this.

At the moment what it is anoying me is that Sane is slow with the Samsung devices conpared to scanning from Windows: it takes 45 second to scan a page in "Grayscale - 256 Levels" and 300 dpis while Windows or scanning to a USB memory plugged into the scanner only takes 15. My theory based on the number and size of the packages in my network capture is that the Windows driver is able to tell the scanner to scan and transfer the image already compressed in JPEG format. In Sane I only found support for PNM and TIFF...
I suspect you are correct.  Personally I find that to be no loss, as I much prefer to take the time/storage penalty at the front end and decide later whether the compression is necessary/worthwhile.  I'm probably in a minority, though, and it also doesn't really matter since I personally have no use for this script (no scanner on my printer).  I doubt there is an easy solution to that, unless there is a physical printer configuration option to default to jpeg output.

Of course, it may also just be that the Windows driver is faster or more efficient in its transfer protocol.  That would hardly be surprising given the massive investment in Windows support Samsung has compared to Linux.

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #4 on: December 30, 2012, 06:29:29 PM »
I found a few hours today to finish a new version of the script to be include in a package:

 - binary file in /opt/Samsung/mfp/bin/scannerServer.py
 - config file in /etc/samsungScannerServer.conf (can be changed in scannerServer.py)
 - log file in /var/log/samsungScannerServer.log (defined in samsungScannerServer.conf)
 - use python logrotate
 - /etc/init.d/samsungScannerServer
 - support to create PDFs of multiple pages
 - DPI settings working for JPEG and PDF files
 - support for image filters in the config file (see example in samsungScannerServer.conf)

How to use:
 - extract content of the tarball to your root file system
 - modify the settings at /etc/samsungScannerServer.conf
 - reboot or run "sudo service samsungScannerServer start"

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #5 on: January 01, 2013, 07:02:14 AM »
I will package this up and add it to the repository, sometime in the near future.

tuomis

  • Testing the water
  • **
  • Posts: 1
    • View Profile
  • Linux Distribution: Ubuntu
  • Printer: Samsung scx-4521f
Re: Scan to PC in Linux
« Reply #6 on: February 27, 2013, 04:23:23 AM »
I've started the server, with no Errors, but when i've checked the log file saw the errors. Could you, please check the attached log file, to help me fix this.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #7 on: March 03, 2013, 10:12:17 AM »
I've started the server, with no Errors, but when i've checked the log file saw the errors. Could you, please check the attached log file, to help me fix this.

No log file was attached.

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux
« Reply #8 on: March 08, 2013, 05:06:26 PM »
@bchemnet: Have you already packaged this and added it to the repository? What would be the package name?

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #9 on: March 08, 2013, 06:10:47 PM »
@bchemnet: Have you already packaged this and added it to the repository? What would be the package name?

Not yet, my to-do-immediately list hasn't cleared enough for to spend time on it yet.  But you can still use the attachment in this thread.

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux
« Reply #10 on: March 09, 2013, 08:13:36 AM »
OK, I installed it, configured it and it (kind of) works with the CLX-3305W over WiFi! (Only the first page is scanned, and sometimes the server needs to be restarted, maybe more details in a later post.)

But for all other interested people who want to install this in ubuntu you need the following packages for the scan server to work (tested with quantal):

Code: [Select]
sudo apt-get install python-imaging-sane python-pypdf python-pysnmp-common

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Howto: automatic startup of server on system boot
« Reply #11 on: March 11, 2013, 11:28:42 AM »
How to use:
[...]
 - reboot or run "sudo service samsungScannerServer start"
For other users to know: Being started on system boot is not the default behaviour.

If you want the server to be registered for automatic start up on system boot, run:
Code: [Select]
sudo update-rc.d samsungScannerServer defaultsAnd if you want to unregister it:
Code: [Select]
sudo update-rc.d -f samsungScannerServer remove

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux - new version 0.2.2
« Reply #12 on: March 13, 2013, 11:16:10 AM »
Ok, I now post a new version 0.2.2 with a few bug fixes and enhancements by me. For me this is still not working correctly, I can only scan one image and then have to wait around 5 minutes to do the next without restart of the server. But I still wanted to post this (as I think cleaner) version, since those problems might be device related. (The original author angelnu has a CLX-3300, I work with a CLX-3305W with updated firmware V3.00.01.18 as of 01/16/2013.)

All you need is in the attachments. To install the server first install needed packages:
Code: [Select]
sudo apt-get install python-imaging-sane python-pypdf python-pysnmp-common
After you downloaded the attached files into one directory, run the following from there:
Code: [Select]
bash installSSS.sh samsungScannerServer_v022.tgz
and answer Yes to continue with default settings (nothing to be overwritten during 1st time install).

Start the server with:
Code: [Select]
sudo service samsungScannerService start # or stop or restart

If you want the server to be registered for automatic start up on system boot, run:
Code: [Select]
sudo update-rc.d samsungScannerServer defaultsAnd if you want to unregister it:
Code: [Select]
sudo update-rc.d -f samsungScannerServer remove

Read the changelog, if you wanna know what's new (and inspect the code if you like) and have fun. ;)

EDIT: In the changelog I meant uid 1000 (!not 100!).
EDIT: The installSSS.sh script is not the correct one (it is for a GUI package, sry my bad!) just use the script in the next post.
« Last Edit: March 29, 2013, 05:18:14 PM by totally-king »

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux -- stable version 0.3 out
« Reply #13 on: March 29, 2013, 05:33:02 PM »
I finally got it to work! It seems in the SANE backend for the CLX-3305W multi-page scanning is not implemented. That's why I wrote a TCP (and UDP) proxy that interferes with these messages as a man in the middle and recreates what the Samsung Windows server is doing. (Yet more reverse enginerring ... :| ) In the attached deb package this new method is disabled by default (you can enable it by editing `/etc/samsungScannerServer.conf`).

So, deb packages should install and work out of the box. The GUI package is an application indicator for ubuntu that provides status messages and easy clicks to restart / stop the server app. (Helpful if you don't run this on a server but your desktop PC or notebook.) Changelogs are included in the deb packages.

I provided the installSSS.sh script is for use with the tarball in the previous post (since the old script was broken) for historical reasons. But you should use this version, since it does not break any functionality!

EDIT: GUI deb file in next post. Misclicked, sry ... am a little tired. Just ignore the tar.gz file.
« Last Edit: March 29, 2013, 05:35:25 PM by totally-king »

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux -- stable version 0.3 out
« Reply #14 on: March 29, 2013, 05:36:10 PM »
deb file for GUI (ubuntu application indicator)

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #15 on: April 02, 2013, 08:30:42 PM »
When I finally get to this, I'll include all the changes you've made into the repository.

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux
« Reply #16 on: April 03, 2013, 04:11:57 AM »
Nice, thank you! I hope it isn't too much trouble for you. Only (review? and) sign the packages and add them to the repo or am I thinking too simple? If you need anything else just tell me.

On another note: Fixed dependency issues with python-pysnmp* on ubuntu quantal (12.10), tested before only on precise (12.04): new version attached.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #17 on: May 04, 2013, 09:43:14 PM »
An update: with all the other repository changes I have just finished making, I have not yet had time to deal with this package.  I will have to make some minor changes to align it with the new structure I'm using for the other packages, but it looks like no big deal.  I'll post when they are available, certainly within the next few days.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #18 on: May 05, 2013, 01:29:01 PM »
Here's a pass at repackaging.  Since I can't actually test that they completely work, I'm posting here first for testing.  Please let me know whether or not these packages are fully functional.  Once confirmed, I will add to the repository.

Changes:
Dependencies:
I could not determine any explicit reason to depend on the Configurator instead of just the driver, so I modified that dependency to the driver.
GUI depends on sudo.
Other names updated to match new format.

Naming/location:
Names use suld- instead of samsungmfp-.
Program names more consistently use "samsungScannerServer" style instead of that mixed with "scannerServer" (I think I fixed the necessary references in config files, the desktop file, and the python scripts).
Files moved from /opt/ to /bin/.

Init scripts:
Standard Debian handling of init scripts for scantopc with postinst/prerm/postinst scripts.

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #19 on: May 09, 2013, 08:39:58 AM »
Thanks totally-king and bchemnet! Sorry for following this thread: I assume I forgot to subscribe for updates...

I added a few fixes/functions (please see attached version 0.3.2):
# - Allow saving files outside ~
# - Check scanner connection at start
# - Small problem at program clean-up when MODIFIED_SANE is not used

I sucessfully tested the package with the samsung drivers 4.1 and 4.0.39  on Ubuntu 12.10 64 bits :-) but python gets a segmentation fault on 13.04 in the PIL library :-( It seems that other PIL users are also affected so hopefully it gets fixed soon. I tried to run the code on Python 3 (after using the 2to3 conversion tool) but Sane and PIL are not available.
« Last Edit: May 09, 2013, 08:47:12 AM by angelnu »

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #20 on: May 09, 2013, 09:51:52 PM »
Thanks.  I'll incorporate this into the package and plan to release this weekend.

PIL has not had a release in 4 years, and it's not clear when or if there will be another.  Debian experimental has the pillow (PIL fork) versions of the packages that theoretically support python 3, and/or may solve the segmentation fault problems in 13.04, should you feel like trying those packages.

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #21 on: May 10, 2013, 10:31:19 AM »
Thanks bchemnet! I am giving it a try now. If the replacement fixes the problem I will upload a newer version. I should also be able to make the code compatible with python3.

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #22 on: May 11, 2013, 05:28:19 PM »
The problem in Ubuntu Raring came actually with the switch to Pyllow. There the PDF plugin is broken due to a new feature added to the JPEG plugin.

I opened a bug at pyllow: https://github.com/python-imaging/Pillow/issues/215

Until this is fixed, the save to PDF in the scanner will be broken. I could try a circumvention or save the JPEG files and call an external tool to do the conversion if this is not fixed soon but I will give the Pyllow team a chance :-)

Update: I fixed the Pillow issue upstream so now we just have to wait for it be picked into the distros. Until this is done I included a circumvention for Pillow 2.0.0.

Bonus: the code is now Python 3 ready. I could not completly test it since some dependencies are not available for python3 yet.
« Last Edit: May 11, 2013, 07:52:52 PM by angelnu »

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #23 on: May 12, 2013, 02:44:22 PM »
Am I correct in assuming that the 0.4.0 version is still compatible with Python 2.7?

If so, I can go ahead and put together a package based on this.  When the revised pillow reaches distributions (probably with the 13.10 release for Ubuntu), a package can be released without your current workaround.  And when the remaining dependencies are available for python 3, a python 3 version can be released.

Does all that sound like I'm correctly understanding the situation?

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #24 on: May 12, 2013, 05:05:40 PM »
Yes, the package has to (and does) run on Python 2.7 until the python3 dependencies are solved.

My circumvention only activates with Pillow 2.0.0 so there is no rush to remove it: it should dissable automatically if anything than Pillow 2.0.0 is used.

For 13.10 I will give it again a try to get it running on Python 3. The code should be prepared so hopefully just a test and we can switch.

Btw: I noticied that the service did not start automatically after a reboot. The reason is that in computer the network is actually configured after login (from the networkconfiguration applet). I will try to add a version that keeps periodically retrying when the network is down.

Update: I added retries every 30 seconds until the scanner can be contacted. I also updated the init.d script according to http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/facilname.html

Hopefully now this is the stable version :-) Waiting for your package.
« Last Edit: May 12, 2013, 06:09:10 PM by angelnu »

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #25 on: May 15, 2013, 09:17:15 PM »
The package is up.  Let me know of any issues and/or updates.

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #26 on: May 18, 2013, 08:41:48 AM »
Thanks bchemnet,

I received the update automatically from your repository since I had already your beta version.

One small issue: the package update just start the service instead of doing a restart. So after the upgrade the old daemon keeps running.

Another problem I found is that at least with my scanner I have to use suld-driver-4.00.39. With suld-driver-4.01.17 the multi-page scan does not work: the scanner does not use the document feeder and instead just scans the page inside the scanner.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #27 on: May 18, 2013, 01:11:21 PM »
One small issue: the package update just start the service instead of doing a restart. So after the upgrade the old daemon keeps running.

I'll fix that.

Another problem I found is that at least with my scanner I have to use suld-driver-4.00.39. With suld-driver-4.01.17 the multi-page scan does not work: the scanner does not use the document feeder and instead just scans the page inside the scanner.

If all the driver versions worked correctly, I would not need to package 7 versions....  But 4.01.17 in particular involved lots of changes, so I'm not entirely surprised it appears to quite full of bugs.  It's particularly unfortunate that I cannot even do basic testing on it because of Samsung's decision to drop support for my printer.  My general policy when they make major changes like that is to wait for the second version before I package, but in this case there doesn't seem to be a second version coming any time soon and there are several printers that otherwise would have no working driver.

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #28 on: May 18, 2013, 05:50:11 PM »
Thanks for continuing your work even if it does not benefice you directly any longer!

Should we expect new releases of the 4.0 version? I will stay on it until there is a newer release of the 4.1 version since multiscan is pretty valuable for me.

If I find some time I will see if I can reproduce the problem just with pure sane to discard Pillow problems but I am quite convinced that this time the Bug is in the Samsung driver and not in Sane/Python. With MORE time, maybe reverse-engineering the scan protocol would be the best solution: it is also bad transfering RAW images from a scanner that can transfer JPEGs directly...

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux
« Reply #29 on: May 19, 2013, 07:58:43 PM »
I don't expect Samsung to release any further 4.00.xx driver versions.  And for the last 18 months or so, they have only released any new versions in parallel with introduction of a new printer.  Therefore, I don't expect a new 4.01.xx driver before fall, or possibly even next spring, unless Samsung decides the bugs are severe enough to justify a special release.

However, for your purposes, the lack of updates is not important.  The 4.00.39 driver should continue to work for at least a couple of years, probably much longer, before some system update starts to cause problems with it.

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux
« Reply #30 on: May 20, 2013, 05:18:02 AM »
Ok, then I will let my setup using 4.0.39.

I think that this time I registered correctly to receive notifications for this thread so that I am informed of updates/problems of other users. If I did not not I guess that I will notice next time I have to install a new computer at home ;-)

rombas

  • Testing the water
  • **
  • Posts: 3
    • View Profile
  • Linux Distribution: Ubuntu 12.04
  • Printer: Samsung SCX-3405
Re: Scan to PC in Linux (Development)
« Reply #31 on: June 01, 2013, 04:23:25 PM »
Hello,

could somebody help me to find out why ScannerServer cannot connect to Saned? The package was installed from a repository.
I can perform scanning with Sane client from Windows without issues. First notice is that ScannerServer tries to connect to 80 port instead of 6566.
Well, I configured Saned to run on 80 port, also tried several options in configuration but without success. All details are in the attachment.

Thank you in advance.


angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux (Development)
« Reply #32 on: June 02, 2013, 03:11:57 AM »
Hi,

the scannerServer packages is only for those scanners that have a screen and allow to trigger the scan directly from the scanners. For theses scanners the scannerServer package connects to the web interface (therefore port 80) to find out when you press the "scan" key and what settings you selected. Afterwards it uses Sane to scan the page.

Does Sane work for you from Linux? Can you trigger scann from your Samsung scanners that end as file in your PC?

rombas

  • Testing the water
  • **
  • Posts: 3
    • View Profile
  • Linux Distribution: Ubuntu 12.04
  • Printer: Samsung SCX-3405
Re: Scan to PC in Linux
« Reply #33 on: June 02, 2013, 04:20:01 AM »
Thank you for the quick response.

Does that mean that Scanner must have web interface and ethernet or wireless port?
My device SCX-3405 has USB port only, but it also has a panel with a button "Scan to". If I connect this
scanner to Windows machine, where Samsung Easy Print Manager runs, I can click "scan to" and "start"
on the device, and scanned image arrives to Windows folder. I would want the same functionality with Linux
server.
I can do the scanning through Sane already:
1) using Xsane on the same Linux server (direct USB connection or via IP);
2) using SaneTwain interface from Windows (via IP)
But "Scan to" button doesn't work with Linux machine. Can ScannerServer help here?

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux (Development)
« Reply #34 on: June 02, 2013, 05:47:55 AM »
The scanerServer is for scanners connected via network only so it will not work if you connect your scanner via USB.

Supporting a USB connected scanner will require the reverse-engineering of the USB protocol. If your scanner just have a key to trigger the scan then maybe the following tool works for you: http://scanbuttond.sourceforge.net/ There is an (old) tutorial at http://archive09.linux.com/feature/59138

rombas

  • Testing the water
  • **
  • Posts: 3
    • View Profile
  • Linux Distribution: Ubuntu 12.04
  • Printer: Samsung SCX-3405
Re: Scan to PC in Linux
« Reply #35 on: June 02, 2013, 08:56:20 AM »
Tried scanbuttond. Unfortunately, Samsung is not supported there.
BTW, thanks for your support.


smika

  • Testing the water
  • **
  • Posts: 3
    • View Profile
  • Linux Distribution: Linuxmint 12.10
  • Printer: SCX-????
Re: Scan to PC in Linux (Development)
« Reply #36 on: June 07, 2013, 10:12:02 AM »
Sorry fot this post. I see that my other post was moved.
« Last Edit: June 07, 2013, 10:13:40 AM by smika »

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development) - Updates to version 0.4.2!
« Reply #37 on: July 27, 2013, 12:59:02 PM »
Thanks a lot to angelnu and bchemnet for your support and effort! And sorry I was leaving you alone lately. Well, the thing is I don't always have an MFP to test scantopc with, since I wrote this program mainly for my partner, who is living in another town. But now I'm back. ;)

Now v0.4.2:

I did a few bugfixes (compatibility to modified sane method was broken), and made some changes to the GUI part, so that it works with angelnu's improvements of the server backend and doesn't print out fuzzy messages. (= (See binary files destined for /usr/bin in attachment.)

The package description of suldr-scantopc-gui still refers to samsungmfp-scantopc, this should be updated to suldr-scantopc.

Also I would appreciate having the changelogs within the deb files as I originally implemented them (see attachment). When I created the deb packages I just renamed them to changelog and put them in the debian folder.

And maybe one could add a postinst routine to suld-scantopc-gui that disables the automatic startup (at bootup) of the server backend, since most people would probably use this package on desktop PCs and don't need the server running in background all the time. Like:
Code: [Select]
sudo update-rc.d -f samsungScannerServer remove
And of course the corresponding postrm code:
Code: [Select]
sudo update-rc.d samsungScannerServer defaults

I don't know really know how, but couldn't one ensure that suld-scantopc-gui always gets removed before suld-scantop, so no problems regarding these new routines arise?

angelnu

  • Soaking wet
  • ****
  • Posts: 19
    • View Profile
  • Linux Distribution: Ubuntu 12.10
  • Printer: CLX-3300
Re: Scan to PC in Linux (Development)
« Reply #38 on: July 28, 2013, 05:36:29 AM »
Welcome back total-king :-)

Sorry for breaking your extensions: apart from syntax errors there is few I can do...

About starting the service by default: I would expect that only people wanting this feature will install the package. The default settings should work after the installation so ideally people would just need to install the package and do nothing else.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development) - Updates to version 0.4.2!
« Reply #39 on: July 28, 2013, 12:16:25 PM »
I did a few bugfixes (compatibility to modified sane method was broken), and made some changes to the GUI part, so that it works with angelnu's improvements of the server backend and doesn't print out fuzzy messages. (= (See binary files destined for /usr/bin in attachment.)

The package description of suldr-scantopc-gui still refers to samsungmfp-scantopc, this should be updated to suldr-scantopc.

I'll incorporate these into the package in a few days, I'm away from my main system at the moment.

Also I would appreciate having the changelogs within the deb files as I originally implemented them (see attachment). When I created the deb packages I just renamed them to changelog and put them in the debian folder.

The changelogs are present.  I just moved them into /usr/share/doc/<package-name>/ according to the Debian standard.  I will merge the versions you included with the ones I was updating.  However, placing them in /debian/ is technically incorrect, because then they end up in the system control directory when the package is installed.  I also compressed them (again according to the standard), but I'm okay with leaving them uncompressed if you prefer.

And maybe one could add a postinst routine to suld-scantopc-gui that disables the automatic startup (at bootup) of the server backend, since most people would probably use this package on desktop PCs and don't need the server running in background all the time. Like:
Code: [Select]
sudo update-rc.d -f samsungScannerServer remove
And of course the corresponding postrm code:
Code: [Select]
sudo update-rc.d samsungScannerServer defaults

I'll look at this, but my immediate response is similar to angelnu's - that people installing this package probably expect it to always be running (in the sense of not wanting to think about whether or not it is).  And I think defaulting to leaving it always running is probably correct, as it does not really interfere for those who don't need it while still allowing flexibility for those who do.  If a good argument could be made for either case, I can provide another package of the gui that disables running the server, or create a configuration prompt.  That would allow the user to choose.

I don't know really know how, but couldn't one ensure that suld-scantopc-gui always gets removed before suld-scantop, so no problems regarding these new routines arise?

This is possible, I can implement it if necessary.

FYI, the scantopc package has been downloaded about 300 times in the last 2 months, and nearly all of those users also download the gui package.  However, since the forums are so quiet about these packages, I don't know how many are actively using it.  Or if it "just works" for most, or if it is failing regularly.  There definitely seems to be some interest, though.

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development) + Updates v0.4.3
« Reply #40 on: July 28, 2013, 01:58:49 PM »
I agree with both of you, if the scantopc package is installed alone.

But when the GUI package is added I think it is better to refrain from automatic startup of the service. The GUI (ubuntu App Indicator) I wrote starts the server upon its application start (or restarts it if the server is already running) and stops it upon its exit. (To save resources on laptops/netbooks etc. ...) The option to chose what one wants (configure while installing) is good, but doesn't really work, because even if you chose to have the server started upon system boot, as soon as the GUI is closed the server is stopped as well and would then not be restarted until next start of the GUI or reboot.

So maybe one should work on the package description of the GUI package? Like:
Quote
An Ubuntu Application Indicator (a graphical user interface, GUI) for the server app used for the 'Scan to PC' function of Samsung multi function printers (MFPs) in suld-scantopc. It has some convenient buttons and issues informational notification bubbles about incoming scan files. Note: This is intended for notebook/desktop PC users that do not want the backend server to always run but rather started and stopped together with the GUI.

Sorry a/b the changelog issue. I do not know very much about debian packaging. As I clicked on 'Get changelog' in Synaptic it told me nothing was present - which obviously isn't true. I incorporated your changelogs into what I already wrote and attached the new ones. You can leave them compressed, btw - the most standard way is probably the best way. ;)

v0.4.3 (both scantopc and scantopc-gui, see bundled attachment): I improved a few other things (logging and error handling) and added an option to the conf file to disable the scanner object caching introduced by angelnu, since this does not work with multiple servers registered at the same scanner. Ideally the scanner connection should then be closed after each (multipage) scan, but this causes a seg fault (exiting SANE does as well). Problem is, that the scanner only has one port 9400 to listen to one computer running the server ... But for now the general option is there and at least leads to less problems with multiple servers even though the main problem remains. (My scanner usually freezes if two different servers try to reach it via SANE (port 9400) at the same time, and one of the servers gives me some SANE I/O Error ...)


bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development) + Updates v0.4.3
« Reply #41 on: July 28, 2013, 02:29:20 PM »
I agree with both of you, if the scantopc package is installed alone.

But when the GUI package is added I think it is better to refrain from automatic startup of the service. The GUI (ubuntu App Indicator) I wrote starts the server upon its application start (or restarts it if the server is already running) and stops it upon its exit. (To save resources on laptops/netbooks etc. ...) The option to chose what one wants (configure while installing) is good, but doesn't really work, because even if you chose to have the server started upon system boot, as soon as the GUI is closed the server is stopped as well and would then not be restarted until next start of the GUI or reboot.

So maybe one should work on the package description of the GUI package? Like:
Quote
An Ubuntu Application Indicator (a graphical user interface, GUI) for the server app used for the 'Scan to PC' function of Samsung multi function printers (MFPs) in suld-scantopc. It has some convenient buttons and issues informational notification bubbles about incoming scan files. Note: This is intended for notebook/desktop PC users that do not want the backend server to always run but rather started and stopped together with the GUI.

Good points.  As currently designed, you are probably correct about the server always running issue.  I was thinking about it from the point of view of someone who might not always want to run the GUI to be able to scan, but at times might want the notifications, etc.  But as designed, I think your description of the GUI use case is accurate, particularly with the updated description.  I will make the necessary changes.

Sorry a/b the changelog issue. I do not know very much about debian packaging. As I clicked on 'Get changelog' in Synaptic it told me nothing was present - which obviously isn't true. I incorporated your changelogs into what I already wrote and attached the new ones. You can leave them compressed, btw - the most standard way is probably the best way. ;)

No problem.  I didn't learn about all the standards until I started putting together this repository, even though I had built several packages before then.

v0.4.3 (both scantopc and scantopc-gui, see bundled attachment): I improved a few other things (logging and error handling) and added an option to the conf file to disable the scanner object caching introduced by angelnu, since this does not work with multiple servers registered at the same scanner. Ideally the scanner connection should then be closed after each (multipage) scan, but this causes a seg fault (exiting SANE does as well). Problem is, that the scanner only has one port 9400 to listen to one computer running the server ... But for now the general option is there and at least leads to less problems with multiple servers even though the main problem remains. (My scanner usually freezes if two different servers try to reach it via SANE (port 9400) at the same time, and one of the servers gives me some SANE I/O Error ...)

I will update with these changes.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development)
« Reply #42 on: August 04, 2013, 02:29:24 PM »
New packages posted.

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development)
« Reply #43 on: August 05, 2013, 08:09:38 AM »
Thank you very much! The GUI package throws the following error during install (postinst gave back error code 1):
Code: [Select]
update-rc.d: /etc/init.d/samsungScannerServer exists during rc.d purge (use -f to force)

I think, you need to add the '-f' to the invocation of update-rc.d. Since the service samsungScannerServer exists it won't delete the startup links without forcing it to.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development)
« Reply #44 on: August 05, 2013, 09:12:28 PM »
New version up, with the -f (and also re-ordering a couple of statements in postinst that were incorrect).

frankentux

  • Testing the water
  • **
  • Posts: 4
    • View Profile
  • Linux Distribution: openSUSE 12.3
  • Printer: CLX3300FN
Re: Scan to PC in Linux (Development)
« Reply #45 on: September 26, 2013, 08:17:45 AM »
Hi. I built a package for openSUSE (have'nt had a chance to test it yet until I get home). It is available here:
https://build.opensuse.org/package/show?project=home%3Ababelworx&package=python-samsungScannerServer

I still have to do some work with systemd.

What license is this software distributed under? Would it be possible to put a license file in the package?

frankentux

  • Testing the water
  • **
  • Posts: 4
    • View Profile
  • Linux Distribution: openSUSE 12.3
  • Printer: CLX3300FN
Re: Scan to PC in Linux (Development)
« Reply #46 on: September 26, 2013, 03:07:25 PM »
The package is now working (ish) with some manual fixes:
in force_multipart() I force host = '192.168.178.25' (the ip of the scanner)
in queryPrinterScanStatus() I force SCANNER_IP to '192.168.178.25

The reason for  the first one is that the script dies and complains about a non-numeric host (it accepts the ip address). scanimage -L returns something like snmp:net;192.168.178.25 and this chokes the h = http_client.HTTPConnection(host) - which expects an ip, not a string (I think).

The  reason for the second one is the same as the first except that it is now SCANNER_IP which gets the string returned from scanimage -L - that should also be an ip.

Once I manually force those two variables to ip addresses, I get to choose the options on the scanner itself. Those options are apparently successfully transported (and are displayed by the script). However, once initScan() is called, everything goes pear shaped. I get:

INFO:stderr:    imgs, s = initScan()
INFO:stderr:  File "samsungScannerServer.py", line 451, in initScan
INFO:stderr:    s.page_format = size #t-k: bugfix page_format is correct (not page-format)
INFO:stderr:  File "/usr/lib64/python2.7/site-packages/sane.py", line 183, in __setattr__
INFO:stderr:    self.last_opt = dev.set_option(opt.index, value)
INFO:stderr:_sane.error: Invalid argument

When I run scanimage -d 'smfp:net;192.168.178.25' > out.image, it works and I get an image in out.image - thus I don't think that this is related to the samsung uld backend but rather to how the script is calling the sane scanimage function. Here is the system information for sane:

sane-backends-autoconfig-1.0.23-5.1.1.x86_64
sane-backends-1.0.23-5.1.1.x86_64
python-imaging-sane-1.1.7-34.1.x86_64

I'm using the ULD version contained in ULD_Linux_V1.00.06.tar.gz

Any ideas?


totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development)
« Reply #47 on: October 01, 2013, 07:07:57 AM »
Not really. Your scanner ID looks different from what I'm used to and what this application was made for. Mine for example is: smfp:SAMSUNG CLX-3300 Series on 192.168.178.29. Maybe the sane python module can't handle such a name?! You could try initiating a scan through ipython and look if this throws the same error:
Code: [Select]
import sane
sane.init()
dev = sane.get_devices()[0][0]
s = sane.open(dev)
## Edit: check if page_format option is available
if 'page_format' in s.optlist:
    s.page_format = 'A4 - 210x297 mm'
else:
    raise ValueError('page_format option not available')
pic = s.scan()
s.close()
sane.exit()

Edit: Now that I looked at the Traceback again, I think it's probably not the ID causing the sane error. (Still worth a try to check it out the manual way. Seems like there's a bug when trying to set the page format. If the error persists look what kinds of page format strings your scanner expects with scanimage --help -d 'smfp:net;192.168.178.25' and modify the SIZE2SANE dictionary in /etc/samsungScannerServer.conf if necessary.) But your problems with having to force the scanner IP are definitely because of your unusual scanner ID and could be overcome by an alternative IP extraction algorithm (maybe depending on the semicolon?). If you want that just tell me. ;)
« Last Edit: October 01, 2013, 07:31:41 AM by totally-king »

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development) -- updates to v0.4.4
« Reply #48 on: October 01, 2013, 08:57:44 AM »
Here are the modified source and config files for version 0.4.4 of suld-scantopc and suld-scantopc-gui addressing the errors mentioned in http://www.bchemnet.com/suldr/forum/index.php?topic=157.0 and a bit more (updated changelogs included).

frankentux

  • Testing the water
  • **
  • Posts: 4
    • View Profile
  • Linux Distribution: openSUSE 12.3
  • Printer: CLX3300FN
Re: Scan to PC in Linux (Development)
« Reply #49 on: October 01, 2013, 09:53:52 AM »
This is the output of scanimage --help -d 'smfp:net;192.168.178.25'

Options specific to device `smfp:net;192.168.178.25':
    --preview[=(yes|no)] [no]
        Request a preview-quality scan
  Image Quality:
    --mode Color - 16 Million Colors|Grayscale - 256 Levels|Black and White - Halftone|Black and White - Line Art [Color - 16 Million Colors]
        Set the color composition mode of the scanned image
    --resolution 75|100|150|200|300|600|1200dpi [300]
        Set the resolution of the scanned image
  Scan Area:
    --doc-source Flatbed|ADF Simplex [Flatbed]
        Select source of the document to be scanned
    --page-format Statement|Statement (Rotated)|A5|A5 (Rotated)|B5 (JIS)|Executive|A4|Letter|Custom [A4]
        Set the paper format of the scanned page
    -l 0..216mm

        Set left position of the scan area
    -t 0..297mm

        Set top position of the scan area
    -x 0..216mm [210]
        Width of scan-area.
    -y 0..297mm [297]
        Height of scan-area.

Trying the scan in python now (was there a reason you recommended ipython?)

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development)
« Reply #50 on: October 01, 2013, 10:12:29 AM »
Well, I personally like the interactive approach with ipython to exactly see where something goes wrong. You still are in the environment to try another approch.

There it is I think:
    --page-format Statement|Statement (Rotated)|A5|A5 (Rotated)|B5 (JIS)|Executive|A4|Letter|Custom [A4]
        Set the paper format of the scanned page

So as I said, you probably need to update the config file
Code: [Select]
SIZE2SANE={'SIZE_A4': 'A4', 'SIZE_A5': 'A5 (Rotated)',
           'SIZE_B5_JIS': 'B5 (JIS)', 'SIZE_EXECUTIVE': 'Executive',
           'SIZE_LETTER': 'Letter'}
For Statement and Executive (if you want/have that) you need to find out what your scanner's definitions for these formats are (as 'SIZE_A4' is for A4). To do that
Code: [Select]
wget 192.168.178.25/IDS/CAP.XML
and open the file to check for the definitions (if there are any).

frankentux

  • Testing the water
  • **
  • Posts: 4
    • View Profile
  • Linux Distribution: openSUSE 12.3
  • Printer: CLX3300FN
Re: Scan to PC in Linux (Development)
« Reply #51 on: October 01, 2013, 10:44:15 AM »
That fixed it! Here were the steps:

(1) def extractIPs(fileContent):
    pattern = r"((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([ (\[]?(\.|dot)[ )\]]?(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3})"
    ips = [each[0] for each in re.findall(pattern, fileContent)]   
    for item in ips:
        location = ips.index(item)
        ip = re.sub("[ ()\[\]]", "", item)
        ip = re.sub("dot", ".", ip)
        ips.remove(item)
        ips.insert(location, ip)
    return ips
#SCANNER_IP=SCANNER_SANE_NAME.split(' ')[-1]
try:
  SCANNER_IP = extractIPs(SCANNER_SANE_NAME)[0]
except IndexError: # regex failed?
  sys.exit(1)

(2) change the conf file like you said

Would it not make more sense to define SIZE2SANE in the python script rather than in the conf - depending on the sane scanner id, it could be set dynamically?

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development) -- update to v0.4.5
« Reply #52 on: October 02, 2013, 01:21:17 PM »
I added the IPv4 extraction method and also established an algorithm which tries to create the SIZE2SANE dictionary automatically. If one wants to override that, one simply has to define SIZE2SANE in the conf file.

See updated files and changelogs for suld-scantopc v0.4.5 and (reposted) suld-scantopc-gui v0.4.4 in the attachment.

Edit:
@frankentux: Please tell me, if these new versions work for you without any tweaking. If so: mission accomplished! ;) If not: bugfixing time ...
« Last Edit: October 02, 2013, 03:43:11 PM by totally-king »

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development)
« Reply #53 on: October 02, 2013, 01:38:29 PM »
What license is this software distributed under? Would it be possible to put a license file in the package?

I decided to put the deb packages under 'GPL-3+' which means they may be distributed under GPLv3 or any later version of that license. I attached the license text taken from /usr/share/common-licenses/GPL-3 on my ubuntu system, if you need it.

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development) -- GUI update to v0.4.5
« Reply #54 on: October 02, 2013, 03:42:45 PM »
Sry for so many posts. But I found and fixed a bug in the GUI when started by a user that is not configured to own the scan files saved by the server app.

See updated files and changelogs for (reposted) suld-scantopc v0.4.5 and suld-scantopc-gui v0.4.5 in the attachment.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development)
« Reply #55 on: October 02, 2013, 09:23:07 PM »
I expect to have time this weekend to push these out to the repository.

totally-king

  • Expert swimmer
  • *****
  • Posts: 28
  • skills: python, Perl, R, bash
    • View Profile
  • Linux Distribution: Ubuntu 12.10 (quantal)
  • Printer: CLX-3305W
Re: Scan to PC in Linux (Development)
« Reply #56 on: October 06, 2013, 06:27:22 AM »
@bchemnet Thanks for the updates. All is fine except (probably my fault, sry!) that the script of suld-scantopc isn't executable anymore (which leads to a lot of dpkg errors since configuration pre/post routines rely on (re)starting/stopping ...):
Code: [Select]
-rw-rw-r-- 1 root root 59K Okt  2 20:11 /usr/bin/samsungScannerServer.py
The correct mode is probably 755 (-rwxr-xr-x). Maybe you could also apply this to the suld-scantopc-gui script (samsungScannerServerAppIndicator.py), which currently has 775.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development)
« Reply #57 on: October 06, 2013, 06:53:15 AM »
Fixed.

mradic

  • Testing the water
  • **
  • Posts: 2
    • View Profile
  • Linux Distribution: Ubuntu 12.04
  • Printer: SCX-4216F
Re: Scan to PC in Linux (Development)
« Reply #58 on: October 12, 2013, 01:39:58 AM »
Hello people,

After long time I have visited bchemnet site, and was glad to see this thread and really nice feature included in repository, which I use a lot. Thanks angelnu and bchemnet!

For a while, I was using another script:
http://www.jon.demon.co.uk/dell1600n-net-scan/
(download link inside page)

It worked fine with my CLX-3160FN, I have never tried it on CLX-3185FN.

Here is my command line for invoking the script:
./dell1600n-net-scan.pl --listen 192.168.x.x --clx2160n --multi-session --scan-dir /home/guest

For making it "permanent": http://foo2zjs.rkkda.com/forum/read.php?28,1793,1793

But, since I do not need it all the time, I just added icon on menu bar to run application in terminal...

I just thought this might help you in further development...!

Regards,
Momir

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development)
« Reply #59 on: January 16, 2014, 07:55:32 PM »
TotallyKing or Angelnu, any comments regarding this topic?
http://www.bchemnet.com/suldr/forum/index.php?topic=181.0

Secret

  • Testing the water
  • **
  • Posts: 2
    • View Profile
  • Linux Distribution: debian stable
  • Printer: CLX-4195N
Re: Scan to PC in Linux (Development)
« Reply #60 on: March 14, 2014, 09:20:19 AM »
03-14-14 15:00:20 stdout       INFO     Newly registered server 'Storage-Blue' with UniqueID '5cbcd3015823ba0a' has got
03-14-14 15:00:20 stdout       INFO         InstanceID '4'.
03-14-14 15:00:20 stdout       INFO     At program termination unregistering server with:
03-14-14 15:00:20 stdout       INFO         <function unregisterServer at 0x200e770>
03-14-14 15:00:20 stdout       INFO     Init SANE ...
03-14-14 15:00:20 stdout       INFO     Connecting to scanner ...
03-14-14 15:00:24 stdout       INFO     Connected to scanner.
03-14-14 15:00:24 stdout       INFO     Waiting for scan job ...
03-14-14 15:02:13 stdout       INFO         Got it!
03-14-14 15:02:13 stdout       INFO     Waiting for user selection ...
03-14-14 15:02:23 stdout       INFO         Got it!
03-14-14 15:02:23 root         ERROR    Something awful happened! Waiting 10 seconds before trying again.
Traceback (most recent call last):
  File "/usr/bin/samsungScannerServer.py", line 1502, in <module>
    scannWorker()
  File "/usr/bin/samsungScannerServer.py", line 375, in scannWorker
    user_selection = queryUserOptions()
  File "/usr/bin/samsungScannerServer.py", line 292, in queryUserOptions
    user_options['color']=root.find('Color').attrib["Value"]
AttributeError: 'NoneType' object has no attribute 'attrib'
03-14-14 15:02:33 stdout       INFO     Waiting for scan job ...


There is no "Color" in the answer of queryUserOptions().
The Answer is: <?xml version="1.0" encoding="UTF-8"?><root><S2PC_Select><AppIndex Value="3"/><FileFormat Value="FORMAT_JPEG"/><FileName Value=""/></S2PC_Select></root>
The printer seems to only send these 3 attributes, no matter if i change preset values on the panel or not.
Using CLX-4195N with FW V4.00.01.30 and current repository version of samsungScannerServer.

Secret

  • Testing the water
  • **
  • Posts: 2
    • View Profile
  • Linux Distribution: debian stable
  • Printer: CLX-4195N
Re: Scan to PC in Linux (Development)
« Reply #61 on: March 14, 2014, 11:33:49 AM »
03-14-14 17:26:38 stdout       INFO     MODE: Color - 16 Million Colors
03-14-14 17:26:38 stdout       INFO     DPI: 300
03-14-14 17:26:38 stdout       INFO     SIZE: A4
03-14-14 17:26:38 stdout       INFO     Scanning ...
03-14-14 17:26:39 stderr       INFO     Whoops! Problem scanning (maybe version Samsung device driver >= 4.1 and multi-scan?):
03-14-14 17:26:39 stderr       INFO     Traceback (most recent call last):
03-14-14 17:26:39 stderr       INFO       File "/usr/bin/samsungScannerServer.py", line 501, in scanAndSave
03-14-14 17:26:39 stderr       INFO         for im in imgs:
03-14-14 17:26:39 stderr       INFO       File "/usr/lib/python2.7/dist-packages/sane.py", line 113, in next
03-14-14 17:26:39 stderr       INFO         raise
03-14-14 17:26:39 stderr       INFO     TypeError: exceptions must be old-style classes or derived from BaseException, not str

Exceptions from sane.py seem not to be cought correctly there.

nachokb

  • Testing the water
  • **
  • Posts: 1
    • View Profile
  • Linux Distribution: Ubuntu GNOME 14.04
  • Printer: CLX-3305w
Re: Scan to PC in Linux (Development)
« Reply #62 on: May 08, 2014, 08:41:45 AM »
Guys, thanks a lot.

I can confirm I just installed everything from the repo and it all worked smoothly.

This is on Ubuntu GNOME 14.04 + GNOME 3.12 (Staging PPA).

Thanks!

dekkertje

  • Testing the water
  • **
  • Posts: 3
    • View Profile
  • Linux Distribution: Medion
  • Printer: CLX3300
Re: Scan to PC in Linux (Development)
« Reply #63 on: July 07, 2014, 02:44:51 PM »
Hello Everyone,

I saw this document and i'm very interessed in this.
But can anyone tell me how to install SANE on a linux device.
I Can't figure it out in the README.linux.

Thanks a lot.

Melis Dekker

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development)
« Reply #64 on: July 24, 2014, 07:17:18 AM »
SANE is probably available as a package (such as "libsane") through your package manager, if by "device" you mean some sort of computer.

If you mean something like an Android device, I'm not sure whether or not SANE works.

dekkertje

  • Testing the water
  • **
  • Posts: 3
    • View Profile
  • Linux Distribution: Medion
  • Printer: CLX3300
Re: Scan to PC in Linux (Development)
« Reply #65 on: July 25, 2014, 12:59:57 AM »
Hello bchemnet.

Thank you for your reply.
It's a Medion Nas Server. It's accessable via SSH Shell. Can you prefer a good package manager?
I use uwsiteloader, but can't find SANE in it. If you know one, please can you tell me where to find it, and a little help with how to use it?

Thanks a lot.

bchemnet

  • Administrator
  • *****
  • Posts: 475
    • View Profile
  • Linux Distribution: Debian Testing
  • Printer: none
Re: Scan to PC in Linux (Development)
« Reply #66 on: July 26, 2014, 06:57:06 AM »
As far as I can tell, nobody is providing a sane-backends or equivalent package for that type of device.  You might be able to compile it from source, but I have no personal experience that would be helpful to you.

dekkertje

  • Testing the water
  • **
  • Posts: 3
    • View Profile
  • Linux Distribution: Medion
  • Printer: CLX3300
Re: Scan to PC in Linux (Development)
« Reply #67 on: May 31, 2015, 05:12:21 AM »
Hi Guys,

I have a synology nas server. And i would like to have my samsung clx 3305 scanner working on it. I found out i have to use the xerox mfp driver.

But is there someone that can me provide a step by step manual to install the NETWORK scanner on the synology.

Thanks a lot.
Melis

Metafa666

  • Testing the water
  • **
  • Posts: 1
    • View Profile
  • Linux Distribution: Kubuntu
  • Printer: XPress 1860FW
Re: Scan to PC in Linux (Development)
« Reply #68 on: October 01, 2015, 11:24:26 AM »
Hello,

I got today my new Samsung Multi-Printer Xpress 1860FW. I installed the Server from the packages here using Kubuntu Raring, but I get the following error:

./samsungScannerServer.py
Using circumvention for PDF save because you use pillow 2.0.0
INFO:stdout:###########################
INFO:stdout:# Initiating version 0.4.5
INFO:stdout:###########################
INFO:stdout:At program termination joining log listener process with:
INFO:stdout:    <function exitListener at 0x93e517c>
INFO:stdout:Used '/etc/samsungScannerServer.conf' as configuration file.
INFO:stdout:Below is what was configured with it.
INFO:stdout:CONFIG: ENABLED_SERVER=True
INFO:stdout:CONFIG: MODIFIED_SANE=False
INFO:stdout:CONFIG: PROXY_DEBUGLEVEL=1
INFO:stdout:CONFIG: SCANNER_CACHING=True
INFO:stdout:CONFIG: SCANNER_SANE_NAME='smfp:net;192.168.0.109'
INFO:stdout:CONFIG: SERVER_NAME='adweso-laptop'
INFO:stdout:CONFIG: OWNER_UID=1000
INFO:stdout:CONFIG: OWNER='adweso'
INFO:stdout:CONFIG: OUTPUT_PREFIX='${homedir}/Scans/SCAN_${date}__${uid}'
INFO:stdout:CONFIG: def contrastFilter(im):
INFO:stdout:CONFIG:     return ImageOps.autocontrast(im,10)
INFO:stdout:CONFIG: OPTIONS=[
INFO:stdout:CONFIG:     {'name':'Gray-M_PDF-300' ,'color':'COLOR_GRAY','resolution':'DPI_300','format':'FORMAT_M_PDF','size':'SIZE_A4','output':OUTPUT_PREFIX, 'filters':[]},
INFO:stdout:CONFIG:     {'name':'Color-M_PDF-300','color':'COLOR_TRUE','resolution':'DPI_300','format':'FORMAT_M_PDF','size':'SIZE_A4','output':OUTPUT_PREFIX, 'filters':[]},
INFO:stdout:CONFIG:     {'name':'Gray-JPEG-300'  ,'color':'COLOR_GRAY','resolution':'DPI_300','format':'FORMAT_JPEG' ,'size':'SIZE_A4','output':OUTPUT_PREFIX, 'filters':[]},
INFO:stdout:CONFIG:     {'name':'Color-JPEG-300' ,'color':'COLOR_TRUE','resolution':'DPI_300','format':'FORMAT_JPEG' ,'size':'SIZE_A4','output':OUTPUT_PREFIX, 'filters':[]},
INFO:stdout:CONFIG:     {'name':'Gray-M_PDF-75'  ,'color':'COLOR_GRAY','resolution':'DPI_75' ,'format':'FORMAT_M_PDF','size':'SIZE_A4','output':OUTPUT_PREFIX, 'filters':[]},
INFO:stdout:CONFIG:     {'name':'Gray-S_PDF-75'  ,'color':'COLOR_GRAY','resolution':'DPI_75' ,'format':'FORMAT_S_PDF','size':'SIZE_A4','output':OUTPUT_PREFIX, 'filters':[]},
INFO:stdout:CONFIG: ]
INFO:stdout:CONFIG: MODES2SANE={'COLOR_MONO':'Black and White - Line Art', 'COLOR_GRAY':'Grayscale - 256 Levels','COLOR_TRUE':'Color - 16 Million Colors'}
INFO:stdout:CONFIG: EXTENSIONS={'FORMAT_S_PDF':'pdf','FORMAT_M_PDF':'pdf','FORMAT_PDF':'pdf','FORMAT_JPEG':'jpg','FORMAT_S_TIFF':'tiff','FORMAT_M_TIFF':'tiff'}
INFO:stdout:CONFIG: LOG_NAME="/var/log/samsungScannerServer.log"
INFO:stdout:CONFIG: LOG_MAXBYTES=100000
INFO:stdout:CONFIG: LOG_BACKUPCOUNT=1
INFO:stdout:The following was automatically configured.
INFO:stdout:AUTOCONFIG: HOME_DIR = '/home/adweso'
INFO:stdout:AUTOCONFIG: SCANNER_IP = '192.168.0.109'
INFO:stdout:Newly registered server 'adweso-laptop' with UniqueID '2176ad6d8bafe09e' has got
INFO:stdout:    InstanceID '4'.
INFO:stdout:At program termination unregistering server with:
INFO:stdout:    <function unregisterServer at 0x93ca304>
INFO:stdout:Init SANE ...
INFO:stdout:Connecting to scanner ...
INFO:stderr:Error while trying to configure scanning options:
INFO:stderr:    ValueError: SIZE2SANE dictionary must not be empty!
INFO:stderr:You should manually configure SIZE2SANE in '/etc/samsungScannerServer.conf'.
INFO:stdout:Unregistered server 'adweso-laptop' with UniqueID '2176ad6d8bafe09e'.

I uncommented one of the two SIZE2SANE lines in the config file, but the result is the same ?

scanimage -help gives:

Options specific to device `smfp:usb;04e8;346b;0796BJEG700143V':                                                                                                                                         
    --preview[=(yes|no)] [no]                                                                                                                                                                             
        Request a preview-quality scan                                                                                                                                                                   
  Image Quality:                                                                                                                                                                                         
    --mode Color - 16 Million Colors|Grayscale - 256 Levels|Black and White - Halftone|Black and White - Line Art [Color - 16 Million Colors]
        Set the color composition mode of the scanned image
    --resolution 75|100|150|200|300|600|1200dpi [300]
        Set the resolution of the scanned image
  Scan Area:
    --doc-source Flatbed|ADF Simplex [Flatbed]
        Select source of the document to be scanned
    --page-format Statement|Statement(Rotated)|A5|A5(Rotated)|B5(JIS)|Executive|A4|Letter|Custom [A4]
        Set the paper format of the scanned page
    -l 0..215mm

        Set left position of the scan area
    -t 0..297mm

        Set top position of the scan area
    -x 0..215mm [210]
        Width of scan-area.
    -y 0..297mm [297]
        Height of scan-area.

How I can fix this ?

best regards


Andy
« Last Edit: October 01, 2015, 11:32:55 AM by Metafa666 »

Hec

  • Testing the water
  • **
  • Posts: 1
    • View Profile
  • Linux Distribution: Ubuntu server 14.04 LTS
  • Printer: Xpress C1860 FW
Re: Scan to PC in Linux (Development)
« Reply #69 on: February 27, 2016, 07:50:30 PM »
Hi guys,

First of all, thank you for this awesome work. Unfortunately it doesn't work with my printer c1860 series, and I suspect a tiny detail to be the source of this trouble.

Here is what show the logs :

Traceback (most recent call last):
  File "/usr/bin/samsungScannerServer.py", line 1439, in <module>
    SERVER_INSTANCE_ID = registerServer()
  File "/usr/bin/samsungScannerServer.py", line 208, in registerServer
    raise NameError("Error registering server: "+result)
NameError: Error registering server: <HTML>
<HEAD>
</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<CENTER>
<FONT SIZE="+2" COLOR="#FFFFFF" ALIGN="Center">
</FONT>
<B>The document has moved</B><BR>
<B></B>
</BODY>

</HTML>


I am not at all into programming but I had a look into /usr/bin/samsungScannerServer.py
On line 201 (v. 0.4.5) I saw something strange "c:\IDS.XML" which looks like a Windows path to me (but again I am not a programmer, and this may have non incidence at all).

Anyway, I don't think this is the problem as I tried to debug on a machine running Windows.

1) First /IDS/CAP.XML is called and received from the printer
2) then an exchange is made from the GNU machine towards the printer with /IDS/ScanFaxToPC.cgi

So basically, this is all good.


So I wanted to debug the exchanges on GNU/Linux with ssldump on port 443 as https is forced by the printer either through the Samsung programs on Windows or through a simple browser. Surprise, no packets were intercepted. With tcpdump I discovered only http exchanges are made between my GNU box and the printer.

So I think the problem lays here. For registration, the printer forces the client to use https while the script keeps calling on http as it is unable to switch. I have no idea how to change that.

EDIT :
Eureka !! I changed two lines in /usr/bin/samsungScannerServer.py :

Line 154: h = http_client.HTTPSConnection(host, 443)
and line 388: capxmlfile = urllib2.urlopen('https://%s/IDS/CAP.XML' % REAL_SCANNER_IP)

It's not elegant but now registration works.

I then encountered the problem described by Metafa666. So I went to /etc/samsungScannerServer.conf and uncommented the first line. No more SIZE2SANE error.

But unfortunately this is the end of the road for me, as when I try to scan to my Ubuntu server I encounter an error previously exposed by Secret :

02-28-16 04:26:05 root         ERROR    Something awful happened! Waiting 10 seconds before trying again.
Traceback (most recent call last):
  File "/usr/bin/samsungScannerServer.py", line 1504, in <module>
    scannWorker()
  File "/usr/bin/samsungScannerServer.py", line 377, in scannWorker
    user_selection = queryUserOptions()
  File "/usr/bin/samsungScannerServer.py", line 295, in queryUserOptions
    user_options['color']=root.find('Color').attrib["Value"]
AttributeError: 'NoneType' object has no attribute 'attrib'

...

02-28-16 04:37:18 root         ERROR    Something awful happened! Waiting 10 seconds before trying again.
Traceback (most recent call last):
  File "/usr/bin/samsungScannerServer.py", line 1504, in <module>
    scannWorker()
  File "/usr/bin/samsungScannerServer.py", line 347, in scannWorker
    while (queryPrinterScanStatus(SERVER_INSTANCE_ID) != 1):
  File "/usr/bin/samsungScannerServer.py", line 335, in queryPrinterScanStatus
    "Error message: %(e)s.") % locals())
Exception: Could not query printer scan status.
    Result was '[(ObjectName(1.3.6.1.4.1.236.11.5.11.81.11.7.2.1.2.6), Integer32(-1))]'.
    Error message: Integer32 instance has no attribute '__getitem__'.
« Last Edit: February 27, 2016, 09:42:14 PM by Hec »

divx118

  • Testing the water
  • **
  • Posts: 1
    • View Profile
  • Linux Distribution: Ubuntu Xenial
  • Printer: CLX3305FW
Re: Scan to PC in Linux (Development)
« Reply #70 on: April 25, 2016, 01:19:34 PM »
Thanks all for creating this nice tool. I have a CLX3305FW which works great, although I needed to set snmp access to read/write for being able to use MODIFIED_SANE=TRUE. I use ubuntu 16.04 (Xenial) as server. Below the Firmware version of my printer.

Main Firmware Version
V3.00.02.17 DEC-20-2014
Network Firmware Version
V6.01.00
IP Core Software Version
22.01.NW Stack Version
Engine Firmware Version
V1.00.20 2014-07-09
PCL5E Firmware Version
PCL5Ce 6.79.05 07-10-2014
PCL6 Firmware Version
PCL6 7.44.03 08-29-2012
PostScript Firmware Version
4.02.01.01.00.94.01 03-07-2014
SPL Firmware Version
SPL-C 5.59.02 02-24-2014
PDF Firmware Version
4.02.01.01.00.94.01 03-07-2014

 

Repository Information Legal Contact Alternative Drivers