Results 1 to 6 of 6

Thread: Data corruption with read() / ReadFile()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    849
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    6
    Thanked 163 Times in 151 Posts

    Default Re: Data corruption with read() / ReadFile()

    You are aware that the 100ms timer is not guaranteed to "fire" within 100ms?
    (Linux is not a real-time OS.)

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

    Default Re: Data corruption with read() / ReadFile()

    And why use a timer to call the reading?
    It is easier to do - is to use ready-made libraries for use with serial port:
    QextSerialPort
    or
    QSerialDevice v 0.1.0 (but better from SVN) :
    release: http://fireforge.net/frs/download.ph...ice_v0.1.0.zip
    svn:http://fireforge.net/snapshots.php?group_id=199
    Last edited by kuzulis; 20th November 2009 at 16:42.

  3. #3
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default Re: Data corruption with read() / ReadFile()

    Quote Originally Posted by kuzulis View Post
    And why use a timer to call the reading?
    It is easier to do - is to use ready-made libraries for use with serial port:
    QextSerialPort
    or
    QSerialDevice v 0.1.0 (but better from SVN) :
    release: http://fireforge.net/frs/download.ph...ice_v0.1.0.zip
    svn:http://fireforge.net/snapshots.php?group_id=199
    I tried QextSerialPort one or two years ago but it wouldn't compile and it was not maintained anymore.

    I will have a look again at these libs but I want to know why Qt does not work well with direct call's to read()...

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

    Default Re: Data corruption with read() / ReadFile()

    Teuniz ,

    used only QSerialDevice (from SVN).

    Your questions difficult to answer, because you did not show the code.

    If you have any questions QSerialDevice - you can write to me at mail (e-mail address in source code QSerialDevice)

  5. #5
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    64
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default Re: Data corruption with read() / ReadFile()

    Quote Originally Posted by caduel View Post
    You are aware that the 100ms timer is not guaranteed to "fire" within 100ms?
    (Linux is not a real-time OS.)
    Yes, and I checked how many bytes are received during every call to read().
    The device sends 772 bytes per second to the pc. Baudrate of the serial port is 115K2.
    What I see is that one call receives 78 bytes, the next call 0 bytes, next call 78 bytes, next call 0 bytes, and so on.

    When I plug-in the USB-stick, the amount of bytes received per call does not change which gives me the impression that the timer does not delay too much.

    What happens is that in one block of data (772 bytes) 4 bytes are missing.

Similar Threads

  1. Replies: 6
    Last Post: 6th August 2009, 18:18
  2. can`t read a binary data!
    By blm in forum Qt Programming
    Replies: 8
    Last Post: 18th September 2008, 17:56
  3. How can I read binary data to QString?
    By zolookas in forum Newbie
    Replies: 2
    Last Post: 29th July 2008, 21:03
  4. Read Data in formated manner
    By rajeshs in forum Qt Programming
    Replies: 1
    Last Post: 1st January 2008, 13:28
  5. Replies: 3
    Last Post: 23rd June 2006, 18:46

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
  •  
Qt is a trademark of The Qt Company.