Results 1 to 17 of 17

Thread: QextSerialPort - very strange problem with runtime

  1. #1
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default QextSerialPort - very strange problem with runtime

    I've used this library before and didn't have such a problem. I did the same things as always.
    After adding line which opens COM port: port->open(QIODevice::ReadWrite)
    my program can be compiled but i get this message

    Clipboard02.jpg

    I use dynamic linking, i.e.

    in my pro file have this:
    LIBS += -lqextserialport1
    in my sources include header file from library and in build directory have .dll.

    Spend over 5h and can't understand why it happens. When i wrote simple, testing app everything works. Maybe there is a conflict because of using dynamic linked Qwt and QExt?

    My compilator is MinGw-gcc4.4.0, Qt4.8 on Windows 7

    I can add that i use version 1.2 of QextSerialPort, creating QextSerialPort object on heap doesn't make any runtime problem, just opening is not working. All libraries was compiled in MinGw in Qt4.8
    Last edited by code_err; 7th February 2012 at 22:36.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QextSerialPort - very strange problem with runtime

    My money is on a null or invalid pointer.

  3. #3
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    It would be very very nice but it seems not to be so simple:

    entire function

    Qt Code:
    1. QStringList myWindow::findPorts()
    2. {
    3.  
    4. QextSerialPort *myPort = new QextSerialPort("COM1");
    5.  
    6. for(int i = 1; i <= 256; ++i)
    7. {
    8. if(i < 9)
    9. {
    10. myPort->setPortName(QString("COM%1").arg(QString::number(i)));
    11. }
    12. else
    13. {
    14. myPort->setPortName(QString("\\\\.\\COM%1").arg(QString::number(i)));
    15. }
    16. if(myPort->open(QIODevice::ReadWrite))
    17. {
    18. myPort->close();
    19. list << QString("Port: COM%1").arg(QString::number(i));
    20. }
    21. }
    22. delete myPort;
    23.  
    24. return list;
    25. }
    To copy to clipboard, switch view to plain text mode 

    myPort pointer isn't empty as you see. The same code works in a simple, testing app.

    findPorts() is invoked by another function in constructor of myWindow
    Last edited by code_err; 8th February 2012 at 11:41.

  4. #4
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QextSerialPort - very strange problem with runtime

    Why You don't use QextSerialEnumerator ?

  5. #5
    Join Date
    Dec 2010
    Location
    Veszprém, Hungary
    Posts
    34
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    Does it happen in debug and release mode also?
    Shouldn't You link in debug mode qextserialportd1?

    By the way, I haven't used qextserialport in windows7 environment, just in XP

  6. #6
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    Why You don't use QextSerialEnumerator ?
    Because i used to do it that way and it should work anyway (and works fine in other programs)

    Does it happen in debug and release mode also?
    Shouldn't You link in debug mode qextserialportd1?
    I was writing about release mode but in debug mode there is the same error.

    By the way, I haven't used qextserialport in windows7 environment, just in XP
    It works good, usually.

    I've changed qextSerialPort library on version 1.2 alpha and now i have other error message:
    When I try to run it, I get "The application failed to initialize properly (0xc0000005)".

    I tried to apply this hint but it doesn't help much.
    http://www.qtcentre.org/threads/1132...h-QWT-involved

    so i've come back to previous version of QextSerialPort which seems to have some problem with QWT i guess.

    I can add that there is a warning that i have while compiling related to QWT library:

    qwt_interva.h:270: warning: 'bool QwtInterval::isValid() const' redeclared without dllimport after being referenced with dll linkage
    In file included from ....
    from ....
    from ....
    from ....
    Last edited by code_err; 8th February 2012 at 14:45.

  7. #7
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    Maybe i could use QProcess(es) as a form of workaround and there put everything related to QextSerialPort functionality?
    What do you think? But still the normal way of using this library would be much more appreciated

    The problem occurs exactly when i try to open existing port, if port doesn't exist there is no problem, but when existing (close or open) port is opening i see above dialog with error.

    I can also see in external serial port monitor tool that my app in fact opens port and then it crashes.
    Last edited by code_err; 8th February 2012 at 23:32.

  8. #8
    Join Date
    Dec 2010
    Location
    Veszprém, Hungary
    Posts
    34
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    Did You build the qextserial from source?
    Did You download it from sourceforge - it has been moved from there to googlecode and as far as I remeber there is a newer version than 1.2.alpha. (Maybe just the alpha tag was removed)

    If You have the source code, maybe should try to debug the port open function step-by-step, to find out why and where it crashes.

  9. #9
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QextSerialPort - very strange problem with runtime

    Quote Originally Posted by code_err View Post
    Because i used to do it that way and it should work anyway (and works fine in other programs)
    1. This solution works only in Windows. In Linux serial ports names are different.
    2. In this way You produce a list of ports that you can open, not a list of existing ports on your computer.

  10. #10
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    Quote Originally Posted by laszlo.gosztola
    Did You build the qextserial from source?
    Yes, i did.
    Quote Originally Posted by laszlo.gosztola
    Did You download it from sourceforge - it has been moved from there to googlecode and as far as I remeber there is a newer version than 1.2.alpha. (Maybe just the alpha tag was removed)
    Have two versions, the old one from sourgeforge and newer from googlecode, first (that i use in my other apps) shows this error message, the second shows 0x0000005 error, it occurs with conjunction with QWT i suppose.
    Quote Originally Posted by laszlo.gosztola
    If You have the source code, maybe should try to debug the port open function step-by-step, to find out why and where it crashes.
    Probably i will have to.
    1. This solution works only in Windows. In Linux serial ports names are different.
    Maybe will try QextSerialEnumerator
    2. In this way You produce a list of ports that you can open, not a list of existing ports on your computer.
    Yes, but on this list i have also all physical/virtual ports from my pc.
    Thanks for ideas.

  11. #11
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QextSerialPort - very strange problem with runtime

    2 code_err,

    try use another library QSerialDevice 2.0

    The reason for this see here.

  12. #12
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    This changes everything, thanks.

  13. #13
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    I changed my mind. As for now i see that class SerialPortInfo from library QSerialDevice do not see:

    on my Laptop with Win7:
    - any virtual COM port made by several different tools
    - USB to COM - Prolific HUB

    on PC with Win XP
    - can't see virtual ports

    but
    - see physical COM port
    - USB to COM - Prolific HUB

    Unfortunately i need HUB USB->COM so i probably come back to QExtSerialPort

  14. #14
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QextSerialPort - very strange problem with runtime

    I've changed qextSerialPort library on version 1.2 alpha and now i have other error message:
    When I try to run it, I get "The application failed to initialize properly (0xc0000005)".
    0xC0000005
    STATUS_ACCESS_VIOLATION
    The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.

    That is, most likely, your program attempted to dereference a null or invalid pointer.

  15. #15
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QextSerialPort - very strange problem with runtime

    - any virtual COM port made by several different tools
    You Lie! At the very least displayed virtual ports from Eltima Software, Com0Com, etc,
    on XP, Win7

    Library recognizes only those devices that also recognizes the OS,
    ie only those devices that are displayed in the DeviceManager (by Setup API).

    That is, utilities that create virtual ports must be adhere to standards of Windows. For all other virtual ports are created by "curves" utilities - it is the problem of "Curves" tools.

    USB to COM - Prolific HUB
    What Class GUID have this device? What type of device (chip)? Which driver is installed? Displayed whether this device in DeviceManager?

  16. #16
    Join Date
    Sep 2011
    Posts
    86
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QextSerialPort - very strange problem with runtime

    You Lie!
    Easy, don't be so angry, i tried three software tools: Eterlogic VSPEmulator, HHD Free Virtual Serial Port and Eltima Virtual Serial port and they didn't work for me on my notebook but... i realized that it do works when i execute program with admin rights. Anyone know what to do to my app could see ports as normal user? With QExtSerialPort i can see it without any problems.

    That is, utilities that create virtual ports must be adhere to standards of Windows. For all other virtual ports are created by "curves" utilities - it is the problem of "Curves" tools.
    Soft was ok.
    What Class GUID have this device? What type of device (chip)? Which driver is installed? Displayed whether this device in DeviceManager?
    It's working now.

  17. #17
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QextSerialPort - very strange problem with runtime

    Try add GUID {86E0D1E0-8089-11D0-9CE4-08003E301F73} to serialportinfo_win.cpp in
    Qt Code:
    1. static const GUID guidArray[] =
    To copy to clipboard, switch view to plain text mode 
    line 20

    or add GUID your "USB to COM - Prolific HUB" device.

Similar Threads

  1. Strange Problem in Runtime
    By nightroad in forum Newbie
    Replies: 1
    Last Post: 13th October 2010, 11:37
  2. Replies: 8
    Last Post: 23rd June 2010, 22:26
  3. qextserialport problem
    By cae in forum Qt Programming
    Replies: 4
    Last Post: 19th May 2010, 10:48
  4. Problem with QExtSerialPort and a usb modem
    By Althor in forum Qt Programming
    Replies: 4
    Last Post: 31st October 2008, 12:02
  5. Problem in QExtserialport program.
    By dheeraj in forum Qt Programming
    Replies: 5
    Last Post: 31st May 2008, 10:24

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.