Results 1 to 9 of 9

Thread: Qt and COM port access

  1. #1
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt and COM port access

    I am trying to access the Windows COM ports in a QtGui application.
    It works if "console" is enabled, but I do not want to have the black window visible along with my QtGui application.
    If I disable "console" the serial port communication does not work, I suspect all "stdio" is intercepted by some stub module.

    I am using regular Windows programming in my serial com module, and not QIODevice.
    I have tried the QExtSerialport class, but it is not working for me, so I have to stick to the platform specific code.

    Is there any way to have access to serial ports without "console"?

    BN
    MacOSX user dabbling with Linux and Windows.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and COM port access

    Is this really a Qt-related question?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt and COM port access

    Yes, in my opinion it is, since the result depends on the Qt project settings.
    Not using "console" in CONFIG blocks access to the COM port.
    (If I could get the QExtSerialport to work, I would not need this)
    Last edited by bnilsson; 7th June 2009 at 10:30.
    MacOSX user dabbling with Linux and Windows.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and COM port access

    But "console" only switches the console subsystem in the compiler. Try disabling the console from Visual Studio settings (if you use VS) and see if the problem persists.

    QExtSerialPort uses native serial communication as well so I'm not sure if using QExtSerialPort would change anything. IMO the problem is elsewhere.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt and COM port access

    Any hint on how to disable console in Visual Studio?
    "Help" gives nothing.
    MacOSX user dabbling with Linux and Windows.

  6. #6
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt and COM port access

    I got the QExtSerialport example QESPTA built with VS and it is working with HyperTerminal.
    I will try again with this and abandon my own COM port methods for the moment. My problems must be in my usage of the class.
    Unfortunately, QESPTA is event driven and this is not supported in the POSIX implementatioin of QExtSerialport, so in my (working) POSIX code I am just using a timer to read and write to/from the port.
    Annoying that this implementation works fine in POSIX but not in WIN32, for some reason.
    I will have to use completely different code for WIN32 vs. POSIX, so it seems cross platform programming has its limitations.
    Thanks for your patience.
    MacOSX user dabbling with Linux and Windows.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and COM port access

    Quote Originally Posted by bnilsson View Post
    Any hint on how to disable console in Visual Studio?
    "Help" gives nothing.
    It's somewhere in the compilation options. It's called "console subsystem".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt and COM port access

    Found it , thanks. It was in Linker/System settings.
    Toggling /SUBSYSTEM:CONSOLE and /SUBSYSTEM:WINDOWS also toggles COMport working/not working.
    I have no idea wether this is specific to Qt or not.

    BN
    MacOSX user dabbling with Linux and Windows.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt and COM port access

    It's not specific to Qt. QExtSerialPort works fine without the console subsystem. It has to be something in your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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.