Giter Site home page Giter Site logo

Scrambled image is returned about wiasane HOT 46 CLOSED

luizluca avatar luizluca commented on August 19, 2024
Scrambled image is returned

from wiasane.

Comments (46)

mback2k avatar mback2k commented on August 19, 2024

Thanks for your bug report. Please install the v0.0.0.4-g225475d debug build and catch the debug logging using DebugView. Please run DebugView with administrative privileges and kernel logging enabled in order to catch the WIA micro driver debug logging. Then post the debug output of such scan failure here, so that I can investigate on the issue. Thanks.

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

The debug version installer is generating this warning.

Exception EAccessViolation in module wiasane-v0.0.0.4-4-g225475d-dbg.tmp at 00000000.
Access violation at address 00000000. Write of address 00000000.

(not very informative :-), except that it is a null pointer somewhere...)

Anyway, it installed. I'm not sure if I enabled everything necessary but I'll paste the log I captured (sorry, no attach for this file in github). If you need anything else, I'll be away until Tuesday.

BTW, I got another issue. It cannot connect to my server using the FQDN. Only IPv4 address.
(I can ping with that name). Maybe the problem is that my hostname resolves to IPv6 and IPv4 addresses.

Debug output moved to Gist: https://gist.github.com/mback2k/9d5567aac21d3f31bfd3

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Thanks, please try the v0.0.0.4-5-g330f5a1 release build next. It won't output any debug data, but it contains changes that should fix your problem.

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

Sorry, no improvement. Just the same result.

Now, normally, the first try to scan fails (on paint or even inside the scanner properties in windows). The following ones scans without warnings but the retrieved image is still equals to previous version.

I just installed it over the previous version. Should I have to uninstall it first? Also, as soon driver installed, it launched 4 or 5 times the scanner config dialog (where I inform SANE server/port)

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

I just installed it over the previous version. Should I have to uninstall it first? Also, as soon driver installed, it launched 4 or 5 times the scanner config dialog (where I inform SANE server/port)

This is an indicator that there were at least 3 devices configured using the WIA driver. Please try to uninstall it completely and then re-install it again.

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

Uninstalled and reinstalled. No multiple configure this time. Still I get an error when I first try to use the scanner. The second time, it goes without warnings.

However, the scanned image is still not correct. Similar results.
Is there anything better to test on? Maybe a special pattern image?

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Please give v0.0.0.5-1-g3c8a422-dbg a try and capture the debug output using DbgView again. And if you are able to capture the network traffic using Wireshark, that would be awesome. Your images are perfectly fine to illustrate the problem, especially the last one shows it very well.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

Ive got the same exact Problem with scrambled Scans while its working with SaneTwain. Im running SANE on a OpenWRT Router with a Samsung SCX-3200 connected.

I also made a DbgView Log and a WireShark Sniff which you can find here: http://goo.gl/G7Q3cW

Im running the 0.0.0.5-1-g3c8a422-dbg Build from the last Post.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

I think I finally got it, please try: Release or Debug

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

Not for me, same scambled Image :(

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

:/ please try v0.0.0.5-7-g63a7348-dbg. and show me the debug output as well as the original and scanned image.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

You may want to try wiasane-v0.0.0.5-10-g2f4995e-dbg, it has a whole lot more debug output.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

With wiasane-v0.0.0.5-10-g2f4995e-dbg it is working now in Preview, but on actual Scan: Ulead PhotoImpact X3 crahses and PhotoShop CC Throws an "Unknown Error" Dialog. So cant provide a scanned Image, but here is the DebugLog: http://cyablo.de/scan.log

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Thanks a lot, please try wiasane-v0.0.0.5-12-g39a7d83-dbg.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

With this Version the Setup does hang for about 1 Minute after selecting the Scanner and clicking "next". Now Photoshop hangs on "connecting to Samsung SCX-3200" and PhotoImpact completely freezes. Also there is no Debug Output this time.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Please uninstall the old version before installing the new one. If it completely hangs/freezes, there must be a different problem. I just installed and used it without any trouble.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

Did a few uninstall, reboot, reinstall's... now it works and NO scambled Image :)

Edit: But only with PhotoImpact X3, PhotoShop CC is still giving me the "unknown error".

Debug: http://cyablo.de/scan2.log

Edit 2: PhotoImpact scans fine with 75 DPI but crashes on 150 DPI

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

I don't see any issue within the log file. Is it from the crash? Please check if the saned server process has crushed or got stuck. This might happen in case there is a problem during a scan. Then WiaSane will not be able to connect to the server/device again.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

The log is from the "unknown error" in Photoshop. SANED Server working fine. Scan with 75 DPI within Ulead PhotoImpact does work, 150 DPI crashes PI. Photoshop always gives "unknown error", no matter what DPI.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

Photoshop Error:
pserror

PhotoImpact on 75 DPI:
pi75dpi

PhotoImpact on 150 DPI:
pi150dpi

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Thanks, could you please try to scan with 75dpi and 150dpi using Windows Fax and Scan, too? I think I actually saw something in the logfile:

00007882    12.35396194 [2488] wiasane: ------ Scan Requesting 64974 ------     
00007883    12.35398865 [2488] wiasane: SCAN_NEXT   
00007884    12.35414982 [2488] wiasane: Receiving 1920 bytes from data channel  
00007885    12.35420322 [2488] wiasane: Data: 1654926/1675947 -> 0/21021    
00007886    12.35431767 [2488] wiasane: ------ Scan Requesting 0 ------ 

It aborts right there, without returning the pending 21021 bytes of image data. I will have to look into that.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

Windows Fax & Scan@ 75 DPI:

Error on Preview (but Preview shows up correct):
image

Error on Scan:
image
image

Same for 150 DPI

By the way: IrfanView also crashes with 150 DPI while 75 DPI works

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Please try this build wiasane-v0.0.0.5-16-gfab7d78-dbg. It should fix the error message, but I am not sure about the crashes yet.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

150 DPI now works in IrfanView, Windows Fax & Scan, PhotoImpact & PhotoShop without any Errors!

Edit: Thank you very much, this is a great piece of Software and makes scanning over SANED so much more comfortable.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Thanks for your feedback. Did you also try some higher resolutions, e.g. 300 or 600dpi? And is the color actually correct? On the picture above it looks like RGB is interpreted as BGR instead (inversed colors).

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

I did try 300 DPI which also works. Will try to scan a colored Image this evening. This one is only B&W, but looks correct at 100% Zoom.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Thanks. @luizluca would you also mind to try your scan again with the new version linked above?

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

The "freeze", Error is back again after i booted today. I looked into the Scanner-Device:
image

There is my Scanner listed in the Dropdown, but it doesnt even work if i select it.

Cant get ist to work again, reboots dont help, dirty installing does not help. not even uninstalling and reinstalling the Driver :(

SaneTwain and SANEDroid still working...

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

Sure @mback2k. Tonight I'll do it.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

@cyablo is there anything in the logs? Did you try to uninstall, reboot and then install it again?

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

Already tried every combination. Which logs do you mean?

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

After another 10 Minutes of uninstalling, installing, rebooting... i could get ist to work again. Luckily ive got a SDD :) Colors are correct.

from wiasane.

cyablo avatar cyablo commented on August 19, 2024

Did 1 reboot... still works... another reboot... not gonna work 'o clock again :(

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

@cyablo Could you check on your router if there are still multiple saned processes running / stuck? In case it does not work, try to restart the Windows service "Windows Image Acquisition (WIA)" / "Windows-Bilderfassung (WIA)".

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

after clean install

  1. preview worked
  2. scan on 100dpi worked
  3. scan on 600dpi worked

I am using paint as the scanner tool. No errors until now, except for some errors on installer (null pointer?) I'll retry after a reboot and report here.

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

After reboot, I needed to retry several times in order to get a scanning. I get 3 errors (a message that the scanner might be in use) and a good scanner. Always. Maybe this is related to the number of times I installed WIA.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

The problem might be related to your network connection taking some time to become available. The driver tries to connect to the saned server in a 20 second interval. This means that after a reboot or standby you would have to wait at least 20 seconds.

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

@mback2k, it makes no sense for the driver to keep polling the server if no app is using a scanner. This will result in problems for a multifunctional printer connected to OpenWRT (https://dev.openwrt.org/ticket/16770).

As far as I noticed, it is not time dependent. I'll recheck tonight to make it sure. My plan:

  1. Login
  2. Wait 1 min
  3. Test network
  4. Wait 1 min
  5. try to scan
  6. go to step 4

I'll also try to use Sanetwain standalone app to see if there is any difference.

BTW, just after the installation, I had no problem. Scanning always worked. The problem only occurred after the reboot.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

@luizluca I know that this is problematic, but at the moment polling was the only solution available to solve issue #9. Once a WiaSane device is installed and active, the driver connects to the saned server, opens the device and keeps polling.

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

@mback2k, it is definitively network code. I monitored it and it seems that WIASane keeps an open connection. saned does not like something and closes it at some point (TCP FIN). WIASane ACKs but does not seem to recognize it as it did not sent the last 2 TCP close steps (server is kept in FIN_WAIT2 state - http://en.wikipedia.org/wiki/Transmission_Control_Protocol#Connection_termination). Also it sends a new package without opening a new connection. Of course, the server sends a RST because it does not recognize a package from a "closing" connection.

Between the first FIN and the next polling that reopens the connection, WIASANE fails.

Please, no pooling (hack?). WIASane needs proper network code that open connection when it needs, close it afterwards and deals correctly with network errors. Currently, VIASANE with constant open connection will result in a non-functional printer and the frequent disconnections make it unusable for anything more than a single page doc.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

@luizluca As I said, I already know that the current network code is problematic, please also see #4. Please remember that you are dealing with alpha-level software here (0.0.0.5 at the moment) and it's a project I do in my spare time. You don't need to beg for "proper network code".

"that open connection when it needs, close it afterwards" is easier said than done. Take a look at the WIA API in wiasane.cpp. I already started to implement helper methods like "OpenScannerDevice" and "CloseScannerDevice" so that the device is not locked in an open state after individual API calls. The problem is: many of those WIA commands in "MicroEntry" can be called in any order and there is no way to know if a scan is in preparation or not. In the worst case I would have to cache all settings locally and re-open the connection for every call that needs more data from the saned server, e.g. to validate the options or check the ADF for paper. Finding a good solution is on my roadmap.

But regarding the network errors: WiaSane should actually recognize the connection close. This is what the "IsConnected" calls are for. The problem with WinSock is that I don't actually get to know if the connection has been closed until I try to read data from it.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

@cyablo @luizluca So it sounds like the original issue "Scrambled image is returned" was successfully fixed, correct?
I would then like to go ahead and close this issue, but of course @luizluca you are free to open a new issue regarding the connection/network issues.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

@luizluca I am currently trying to adapt the network code to not require a constant connection. First results look promising, since most of the API calls can be handled offline:

CMD_SETXRESOLUTION  offline, but requires device options
CMD_SETYRESOLUTION  offline, but requires device options
SetPixelWindow      offline, but requires device options
CMD_SETDATATYPE     offline
CMD_SETINTENSITY    offline, but requires device options
CMD_SETCONTRAST     offline, but requires device options
CMD_SETSCANMODE     offline
Scan                online

Stay tuned.

from wiasane.

luizluca avatar luizluca commented on August 19, 2024

@mback2k, if it sound like begging, sorry. That was not my intention ;-)
My opinion was only that, as WiaSane is always used through network, this is a critical feature. It is more important than others like authentication or even some scanning configuration.

Original issue is fixed for me. Thanks. Only network remains. However, as you are already working on it, I will not bother with a new issue.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

Thanks for your feedback, @cyablo and @luizluca. Issue will be fixed with the next release. Please open up a new issue in case the network issue persists after the release. I will also post an update here, once a version to test the new network code becomes available.

from wiasane.

mback2k avatar mback2k commented on August 19, 2024

@cyablo @luizluca A version to test the new network code is now available: wiasane-v0.0.0.5-33-gc9a0d97-dbg.exe. Windows still polls the driver every 20 seconds for it's state and a connection is made, but there is no persistent connection anymore. Please test the new version. I would like to release it as v0.0.0.6 some time this weekend. Thanks in advance.

from wiasane.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.