Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usability: Need improved error message when scanner in use by another application #47

Open
srikantkt opened this issue May 12, 2024 · 1 comment

Comments

@srikantkt
Copy link

srikantkt commented May 12, 2024

I needed a tool to specify a different DPI than what the UI offered and this tool saved the day!
My environment: MacOS Sonoma 14.4.1

I had a minor issue when I used this tool for the first time. I didn't realize that I also had preview app attempting to import from the scanner. The error message wasn't obvious. See below

➜  ~ scanline -list
Available scanners:
* HP Color LaserJet MFP M283cdw (F8D366)

Done
➜  ~ 
➜  ~ scanline -flatbed -name s_pp.pdf -resolution 100
Error received while attempting to open a session with the scanner.
Failed to scan document.
Done
➜  ~ scanline -flatbed -name s_pp.pdf -resolution 100 -scanner "HP Color LaserJet MFP M283cdw (F8D366)"
Error received while attempting to open a session with the scanner.
Failed to scan document.
Done
➜  ~ scanline -flatbed -name s_pp.pdf -resolution 100 -scanner "HP Color LaserJet MFP M283cdw (F8D366)" -verbose
Browsing for scanners.
Waiting up to 10.0 seconds to find scanners
Added device: {
    UUIDString = "564E4252-5037-5330-3651-6C02E0F8D366";
    autolaunchApplicationPath = "";
    class = ICScannerDevice;
    connectionID = 0x00000000;
    delegate = "<0x0>";
    deviceID = 0x00000000;
    deviceRef = 0x100001f0;
    iconPath = "(null)";
    locationDescription = "HP Color LaserJet MFP M283cdw (F8D366)";
    moduleExecutableArchitecture = 0;
    modulePath = "/System/Library/Image Capture/Devices/AirScanScanner.app";
    moduleVersion = "1.0";
    name = "HP Color LaserJet MFP M283cdw (F8D366)";
    persistentIDString = "564E4252-5037-5330-3651-6C02E0F8D366";
    shared = NO;
    softwareInstallPercentDone = "0.000000";
    transportType = ICTransportTypeTCPIP;
    type = 0x00000402;
}  availableFunctionalUnitTypes  : 
  selectedFunctionalUnit        : (null) <0x0>
  transferMode                  : ICScannerTransferModeFileBased
  downloadsDirectory            : file:///Users/srikant/Pictures/
  documentName                  : Scan
  documentUTI                   : public.tiff

Done searching for scanners
Found scanner: HP Color LaserJet MFP M283cdw (F8D366)
Opening session with scanner
didOpenSessionWithError: The operation couldn’t be completed. (com.apple.imagecapture error 4294967249.)
Error received while attempting to open a session with the scanner.
Failed to scan document.
Done

Once I figured this out and shutdown/closed the preview app and retried, everything worked as expected.
I am able to consistently reproduce this issue

  1. Ensure scanner is in use from another application. for ex.,
    • open preview and perform import from scanner operation
    • Printers & Scanners --> select printer/scanner --> Open Scanner
  2. Run scanline from terminal --> error message shown above
  3. Terminate app using scanner (from Step 1)
  4. Run scanline from terminal --> successful scan
@klep
Copy link
Owner

klep commented May 15, 2024

Glad to hear scanline is working out for you!

I think probably the right fix here is to output the full error code when scanning fails. I don't think scanline itself should attempt to interpret those error codes, since they could have multiple meanings and it's not something a command line tool would typically do. But I agree that it's non-obvious and next time I'm in the code, I'll bump up the log level on the error code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants