mback2k / wiasane

Scanner Access Now Easy - WIA Driver
https://github.com/mback2k/wiasane/wiki/Downloads
Other
127 stars 18 forks source link

Scanner works only once on Windows 10 over network #38

Open vgooz opened 6 years ago

vgooz commented 6 years ago

Hey,

I have Canon I-Sensys MF3200 scanner plugged into my Raspberry Pi 3 B+ with installed OSMC, Sane and configured to use it over network. Scanner works properly on the Raspberry Pi and on Linux client over network. But I have problem with scanner for Windows clients. It scans only once and after this applications can't find scanner.

NAPS2 displays Driver error message: NAPS2.Scan.Exceptions.ScanDriverUnknownException: Ошибка драйвера сканирования. ---> System.Runtime.InteropServices.COMException: Исключение из HRESULT: 0x8021000A в WIA.CommonDialogClass.ShowTransfer(Item Item, String FormatID, Boolean CancelError) в NAPS2.Scan.Wia.ForegroundWiaTransfer.<>cDisplayClass2_0.b1(WiaState wia) в NAPS2.Scan.Wia.WiaBackgroundEventLoop.<>cDisplayClass8_0`1.b0(WiaState wia) в NAPS2.Scan.Wia.WiaBackgroundEventLoop.<>c__DisplayClass7_0.b0() --- Конец трассировки внутреннего стека исключений --- в NAPS2.Scan.Wia.WiaApi.ThrowDeviceError(COMException e) в NAPS2.Scan.Wia.WiaApi.ThrowDeviceError(Exception error) в NAPS2.Scan.Wia.WiaBackgroundEventLoop.DoSync(Action1 action) в NAPS2.Scan.Wia.WiaBackgroundEventLoop.GetSync[T](Func2 action) в NAPS2.Scan.Wia.ForegroundWiaTransfer.Transfer(Int32 pageNumber, WiaBackgroundEventLoop eventLoop, String format) в NAPS2.Scan.Wia.WiaScanDriver.TransferImage(WiaBackgroundEventLoop eventLoop, Int32 pageNumber, Boolean& cancel) в NAPS2.Scan.Wia.WiaScanDriver.d13.MoveNext() в NAPS2.Scan.ScanPerformer.PerformScan(ScanProfile scanProfile, ScanParams scanParams, IWin32Window dialogParent, ISaveNotify notify, Action`1 imageCallback)

Windows Scan application says: Can't find scanner.

But when I'm using winsane-dbg.exe 192.168.1.100, it works with no problems, displays information about my scanner, scans and receives data. Also scanner device works too, so scanning.

Below winsane-dbg.exe log:


Name: pixma:04A92684_SBF770157116A Vendor: CANON Model: Canon imageCLASS MF3240 Type: multi-function peripheral


Name:
Title: Number of options Description: Read-only option that specifies how many options a specific devices supports. Value: 25 Unit: None


Name: (null) Title: Scan mode Description: Scan mode Value: Unit: None


Name: resolution Title: Scan resolution Description: Sets the resolution of the scanned image. Value: 75 Unit: DPI Word: 75 Word: 150 Word: 300 Word: 600 Resolution: 300


Name: mode Title: Scan mode Description: Selects the scan mode (e.g., lineart, monochrome, or color). Value: Color Unit: None String: Color String: Gray Mode: Color


Name: source Title: Scan source Description: Selects the scan source (such as a document-feeder). Set source before mode and resolution. Resets mode and resolution to auto values. Value: Flatbed Unit: None String: Flatbed


Name: button-controlled Title: Button-controlled scan Description: When enabled, scan process will not start immediately. To proceed, press "SCAN" button (for MP150) or "COLOR" button (for other models). To cancel, press "GRAY" button. Value: 0 Unit: None


Name: (null) Title: Gamma Description: Gamma Value: Unit: None


Name: custom-gamma Title: Use custom gamma table Description: Determines whether a builtin or a custom gamma-table should be used. Value: Unit: None


Name: gamma-table Title: Image intensity Description: Gamma-correction table. In color mode this option equally affects the red, green, and blue channels simultaneously (i.e., it is an intensity gamma table). Value: Unit: None Min: 0 Max: 255 Quant: 0


Name: gamma Title: Gamma function exponent Description: Changes intensity of midtones Value: Unit: None Min: 0.299988 (19660) Max: 5.000000 (327680) Quant: 0.000000 (0)


Name: (null) Title: Geometry Description: Geometry Value: Unit: None


Name: tl-x Title: Top-left x Description: Top-left x position of scan area. Value: 0.000000 (0) Unit: Millimeter Min: 0.000000 (0) Max: 216.746658 (14204709) Quant: 0.000000 (0)


Name: tl-y Title: Top-left y Description: Top-left y position of scan area. Value: 0.000000 (0) Unit: Millimeter Min: 0.000000 (0) Max: 297.010666 (19464891) Quant: 0.000000 (0)


Name: br-x Title: Bottom-right x Description: Bottom-right x position of scan area. Value: 216.746658 (14204709) Unit: Millimeter Min: 0.000000 (0) Max: 216.746658 (14204709) Quant: 0.000000 (0)


Name: br-y Title: Bottom-right y Description: Bottom-right y position of scan area. Value: 297.010666 (19464891) Unit: Millimeter Min: 0.000000 (0) Max: 297.010666 (19464891) Quant: 0.000000 (0)


Name: (null) Title: Buttons Description: Buttons Value: Unit: None


Name: button-update Title: Update button state Description: Update button state Value: Unit: None


Name: button-1 Title: Button 1 Description: Button 1 Value: 0 Unit: None


Name: button-2 Title: Button 2 Description: Button 2 Value: 0 Unit: None


Name: original Title: Type of original to scan Description: Type of original to scan Value: 0 Unit: None


Name: target Title: Target operation type Description: Target operation type Value: 0 Unit: None


Name: scan-resolution Title: Scan resolution Description: Scan resolution Value: 0 Unit: None


Name: (null) Title: Extras Description: Extras Value: Unit: None


Name: threshold Title: Threshold Description: Select minimum-brightness to get a white point Value: Unit: Percent Min: 0 Max: 100 Quant: 1


Name: threshold-curve Title: Threshold curve Description: Dynamic threshold curve, from light to dark, normally 50-65 Value: Unit: None Min: 0 Max: 127 Quant: 1


Format: 1 Last Frame: 1 Bytes per Line: 7680 Pixel per Line: 2560 Lines: 3508 Depth: 8 Scan? (y/n)

TheRikke commented 5 years ago

I had a similar issue and traced on the server side. It looks like wiasane remembers the device by its name. But for usb devices the name may change. At least for backends using libusb. For example the name may be "libusb:003:003" initially. But if the device sleeps, after wake up it will be "libusb:003:004" (or higher number if 004 is taken). wiasane will always use the initial name to open the device and fail. I guess wiasane would need to query the device list and try to find the right scanner by other device parameters.