Menu

Black square

Help
Jiri Stary
2009-11-18
2013-04-15
  • Jiri Stary

    Jiri Stary - 2009-11-18

    Hi, i have a problem with jsane. When i try to scan a page i recieve only a black page. I am using sane backend 0.20 and scanning from xsane remotely or using device software works ok. When I debug saned I noticed that device I/O error is reported and scanning is halted immediately, only about 9 bytes of data are send. Is there any change getting this fixed ?

     
  • Andi McLean

    Andi McLean - 2009-11-18

    Are you setting the x and y offset and size to scan options? (The default depend on the backend)

    when you call:
    frame = device.getFrame()

    change to
    JSane_Wire.showInput = true;
    JSane_Wire.showOutput = true;
    frame=device.getFrame();
    JSane_Wire.showInput = false;
    JSane_Wire.showOutput = false;

    That will display what JSane is sending over the connection.
    Can you post the results?

    Andi

     
  • Jiri Stary

    Jiri Stary - 2009-11-20

    yes I am, I use follwoing settings:

               device.getOption("resolution").setValue("75");
       device.getOption("mode").setValue("Color - 16 Million Colors");
       device.getOption("page-format").setValue("A4 - 210x297 mm");
       device.getOption("tl-x").setValue("0");
               device.getOption("tl-y").setValue("0");
               device.getOption("br-x").setValue("210");
       device.getOption("br-y").setValue("297");

    The Output you requested is:

    <pre><code>
    Out 0 /Out 0 /Out 0 /Out 7 /Word Out = 7
    Out 0 /Out 0 /Out 0 /Out 0 /Word Out = 0
    In 0 /In 0 /In 0 /In 0 /Word In = 0
    In 0 /In 0 /In 222 /In 88 /Word In = 56920
    In 0 /In 0 /In 18 /In 52 /Word In = 4660
    In 0 /In 0 /In 0 /In 0 /Word In = 0
    Getting String
    Out 0 /Out 0 /Out 0 /Out 6 /Word Out = 6
    Out 0 /Out 0 /Out 0 /Out 0 /Word Out = 0
    In 0 /In 0 /In 0 /In 0 /Word In = 0
    In 0 /In 0 /In 0 /In 1 /Word In = 1
    In 0 /In 0 /In 0 /In 1 /Word In = 1
    In 0 /In 0 /In 7 /In 62 /Word In = 1854
    In 0 /In 0 /In 2 /In 106 /Word In = 618
    In 0 /In 0 /In 3 /In 108 /Word In = 876
    In 0 /In 0 /In 0 /In 8 /Word In = 8
    In 255 /In 255 /In 255 /In 255 /Word In = -1
    </code></pre>

    This is debug from saned -d128

    <pre><code>
    stary@krusovice:/usr/bin$ saned -d128
    main: starting debug mode (level 128)
    read_config: searching for config file
    read_config: done reading config
    saned (AF-indep+IPv6) from sane-backends 1.0.20 starting up
    do_bindings: trying to get port for service "sane-port" (getaddrinfo)
    do_bindings:  socket () using IPv6
    do_bindings:  setsockopt ()
    do_bindings:  bind () to port 6566
    do_bindings:  listen ()
    do_bindings:  socket () using IPv4
    do_bindings:  setsockopt ()
    do_bindings:  bind () to port 6566
    do_bindings:  bind failed: Address already in use
    run_standalone: spawning Avahi process
    run_standalone: waiting for control connection
    saned_avahi_callback: AVAHI_CLIENT_S_RUNNING
    saned_create_avahi_services: adding service 'saned'
    saned_avahi_group_callback: service 'saned' successfully established
    handle_connection: processing client connection
    check_host: detected an IPv4-mapped address
    check_host: access by remote host: ::ffff:127.0.0.1
    check_host: remote host is IN_LOOPBACK: access granted
    init: access granted
    init: access granted to stary@::ffff:127.0.0.1
    process_request: waiting for request
    process_request: got request 1
    process_request: waiting for request
    process_request: got request 2
    process_request: access to resource `smfp' granted
    process_request: sane_open returned: Success
    process_request: waiting for request
    process_request: got request 4
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 5
    process_request: waiting for request
    process_request: got request 7
    start_scan: trying to bind data port 0
    start_scan: using port 56920 for data
    process_request: waiting for data connection
    process_request: access to data port from ::ffff:127.0.0.1
    do_scan: start
    do_scan: trying to read 8188 bytes from scanner
    do_scan: read 0 bytes from scanner
    do_scan: status = `Error during device I/O'
    do_scan: statuscode `Error during device I/O' was added to buffer
    do_scan: trying to write 9 bytes to client
    do_scan: wrote 9 bytes to client
    do_scan: processing RPC request on fd 4
    process_request: waiting for request
    process_request: got request 6
    do_scan: done, status=Error during device I/O
    process_request: waiting for request
    process_request: got request 3
    process_request: waiting for request
    process_request: got request 10
    bailing out, waiting for children…
    bail_out: all children exited
    stary@krusovice:/usr/bin$
    </code></pre>

     
  • Andi McLean

    Andi McLean - 2009-11-20

    I think there might be a problem with the following lines of code:

    <pre><code>
    device.getOption("mode").setValue("Color - 16 Million Colors");
    device.getOption("page-format").setValue("A4 - 210x297 mm");
    </code></pre>

    If you use the Tester.java program found under JSane_Frontends, it should show you the options available and values you can use.

     
  • Jiri Stary

    Jiri Stary - 2009-11-20

    I downloaded the jar file with frontend and it threw exception, howerer if i scan scanner options with this code the vaules seems correct:
    <pre><code>
      int options = device.getNumberOptions();

       for (int loop = 0; loop < options; ++loop)
       {
           JSane_Base_Option_Type_Descriptor option = device.getOption(loop);
           System.out.println(option);
           if (!( option.getValueType()  instanceof JSane_Base_Type_Group )
           && device.getOption(loop).toString().length() > 15 ) //otherwise i get null pointer
           {
        System.out.println("Name: " +device.getOption(loop).getName());
       
          
           System.out.println(device.getOption(loop).getValue());
           }
       }
    </code></pre>

    <pre><code>
    Option - 3 mode Sets the color composition mode of the scanned image
    Black and White - Line Art
    Grayscale - 256 Levels
    Color - 16 Million Colors

    ……

    Option - 6 page-format Sets the paper format of the scanned page
    A4 - 210x297 mm
    Letter - 8.5"x11"
    Statement - 5.5"x8.5"
    Executive - 7.25"x10.5"
    A5 - 148x210 mm
    B5 - 176x250 mm
    B5 (JIS) - 182x257 mm
    Quarto - 215x275 mm
    Envelope #9 - 3.875"x8.875"
    Envelope #10 - 4.125"x9.5"
    Envelope #11 - 4.5"x10.375"
    Envelope #12 - 4"x11"
    Envelope #14 - 5"x11.5"
    Envelope DL - 110x220 mm
    Envelope C5 - 162x229 mm
    Envelope C6 - 114x162 mm
    Envelope C6/C5 - 114x229 mm
    Envelope B5 - 176x250 mm
    Envelope B6 - 125x176 mm
    Envelope - 110x230 mm
    Envelope Monarch - 3.875"x7.5"
    A5 Extra - 174x235 mm
    B5 (ISO) Extra - 201x276 mm
    Custom
    </code></pre>

    The values I used are the default ones and if i ommit them the result is the same

     
  • Jiri Stary

    Jiri Stary - 2009-11-20

    I have a new info. If  I keep the connection alive, the first attempt to scan fails returning a black square but the second attempt is succesful.

     
  • Anonymous

    Anonymous - 2010-06-01

    I am getting the same black square. A try to scan with two attemps and the second was succeful.

    I think it is a connection problem between API and saned. Do you get any solution this issue?

     
  • Andi McLean

    Andi McLean - 2010-06-01

    Is it just a black square on the image or is the whole image black?

    Do you get the same results when using XSane , scanimage?

     
  • Anonymous

    Anonymous - 2010-06-02

    I 'll try with scanimage tomorrow. Here I have only a hp scanners and all is working fine. With SAMSUNG (SCX4521) scanner i got the black square (whole image).
    Using XSane image scanner (Ubuntu 9.10 distro) the scanner works ok too.
    But when i use java api, black square.
    When I do the following code:
    device.open();
    JSane_Base_Frame frame = device.getFrame();
    // Get the image from frame
    BufferedImage image = frame.getImage(false);
    device.close();
    device.open();
    … the rest of the options …
    //device.open();
    frame = device.getFrame();
    // Get the image from frame
    image = frame.getImage(false);
    device.close();
    connection.exit();


    The scan works OK.

    It appears to be a connection problem. I Tried to run the Morena Studio Applet and i've got almost the same error (null pointer).

     
  • Anonymous

    Anonymous - 2010-06-02

    Another info:

    When we are at the first scan atempt, the  !_param.lastFrame return true.

     
  • Andi McLean

    Andi McLean - 2010-06-02

    Can you run saned from the command line with debug turned on

    saned -d128

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.