Results 1 to 3 of 3

Thread: Sane sample app gives different results on pseudo QT terminal and on gnome-terminal

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Posts
    4
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Sane sample app gives different results on pseudo QT terminal and on gnome-terminal

    Hi All,
    I wrote sample code that uses sane library to communicate with my scanner.

    //#include <QCoreApplication>
    #include <iostream>
    #include <sane/sane.h>
    #include <stdio.h>
    using namespace std;

    int sane_backend_versioncode;
    const SANE_Device **devlist=NULL;
    int num_of_devs;

    int main(int argc, char *argv[])
    {
    sane_init(&sane_backend_versioncode, NULL);

    sane_get_devices(&devlist, SANE_FALSE );

    for (num_of_devs = 0; devlist[num_of_devs]; ++num_of_devs);

    if (num_of_devs > 0) /* devices available */
    {
    std::cout << "Number of scan devices is " << num_of_devs <<".\n";
    }
    else
    {
    std::cout << "Number of scan devices is 0";
    }

    sane_exit();


    cout << "" << endl; // prints
    return 0;
    }

    What I get from Qt Creator is surprising. On its pseudo terminal I get message "Number of scan devices is 0" however when I execute the same compiled binary from gnome-terminal I get that "Number of scan devices is 1". When I created similar project in eclipse I got the same result "Number of scan devices is 1" on its pseudoterminal. Moreover when I set in Qt Creator to launch the compiled app in gnome-terminal I still have the result "Number of scan devices is 0". This was double checked and there is no space for my error.
    Do you know what is going on? When Qt creator launches app it returns almost immediately with result "Number of scan devices is 0". When "Number of scan devices is 1" is returned it is after couple of seconds so after expected scanning. The result of 0 detected devices is in release and debug binary.

    I attached my qt sample app with the above code. I think that it a fault of Qt pseudo terminal. Maybe it disables something that shouldn't be.
    I get that result on Ubuntu 14.04 64bit and USB connected scanner Epson Stylus CX3650. On Qt creator 5.3.1 and 5.5.1.

    Thanks,
    Marcin
    Attached Files Attached Files

Similar Threads

  1. is it possible the qdebug in terminal??
    By iswaryasenthilkumar in forum Newbie
    Replies: 2
    Last Post: 12th May 2015, 07:59
  2. Output to terminal
    By wookie1 in forum Newbie
    Replies: 5
    Last Post: 12th June 2012, 14:22
  3. QT to linux terminal
    By Zexix in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2012, 18:18
  4. terminal widget
    By kernel_panic in forum Qt Programming
    Replies: 11
    Last Post: 21st November 2009, 14:08
  5. Looking for widget to run terminal app
    By marcell in forum Qt Programming
    Replies: 0
    Last Post: 16th May 2008, 16:24

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.