Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QIODevice read() losing bytes. (0x22 0x33 loses 0x33)
Qt 6.11 is out! See what's new in the release blog

QIODevice read() losing bytes. (0x22 0x33 loses 0x33)

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 580 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rickard Gustafsson
    wrote on last edited by
    #1

    This might have to do something with an old Qt version.
    But I am still interested why this happens.

    The scenario:
    Using Qt Creator 2.0.1, based on Qt 4.7.0 (32 bit)
    Opening a serial port via Win_QextSerialPort. Set flowcontrol FLOW_OFF, parity PAR_NONE, data bits DATA_8, stop bits STOP_1.

    When performing a read on the serial port QIODevice, QByteArray read(qint64 maxlen), is used.
    The data expected to be read is {0x00, 0x55, 0x50, 0x11, 0x22, 0x33, 0x44, 0x05} (a LIN data frame)
    As seen this is 8 bytes long, and bytesAvailable() in WinQextSerialPort says that there is 8 bytes available to read. But read(bytesAvailable()) only returns {0x00, 0x55, 0x50, 0x11, 0x22, 0x44, 0x05}, only 7 bytes.

    read(char *data, qint64 maxlen) and readAll() also returns the same value.

    Checking with something else like Tera Term all bytes are received as expected.

    Is this something known? Something interesting behind the behavior? :)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved