Results 1 to 2 of 2

Thread: question about QSerialDevice (baudrate)

  1. #1
    Join Date
    May 2009
    Posts
    75
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default question about QSerialDevice (baudrate)

    I'm tring to use QSerialDevice and I have a question (can you hear me kuzulis? )
    I work under linux and I tried in this way:
    Qt Code:
    1. MyDevice = new TSerialDevice();
    2. MyDevice->setDeviceName("/dev/ttyS0");
    3. MyDevice->setBaudRate(19200);
    4. MyDevice->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
    To copy to clipboard, switch view to plain text mode 

    If I execute this code I can read in console:
    Qt Code:
    1. TPosixSerialDevice::setBaudRate->Device is not open! Error!
    2. Trying to open File
    3. Opened File succesfully
    To copy to clipboard, switch view to plain text mode 

    so it seems wrond the order of calls, so I tried this:
    Qt Code:
    1. MyDevice = new TSerialDevice();
    2. MyDevice->setBaudRate(19200);
    3. MyDevice->setDeviceName("/dev/ttyS0");
    4. MyDevice->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
    To copy to clipboard, switch view to plain text mode 

    No more error in console, but baudrate is set to default (9600)

    So I tried to test baudrate of first piece of code, althought the error on setBaudRate() the baudrate is correctly set to 19200.

    Is this a bug or I am wrong somewhere?

    thanks

  2. #2
    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: question about QSerialDevice (baudrate)

    This is bug!

    You must first open the device and then configure it!


    that is not possible to set speed until the device is not really open!
    It opens by default with the following parameters: 9600 8N1, and only then can set a new speed 19200


    PS:
    The library is still very crude, and it still might be bugs.
    I am now completely transform it.
    Last edited by kuzulis; 18th August 2009 at 09:00.

Similar Threads

  1. qextserialport BAUDRATE problem
    By dheeraj in forum Qt Programming
    Replies: 6
    Last Post: 19th March 2009, 19:29

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.