Missing Flow Control Data (0x13) From Reading Device Data Stream
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs Missing flow control data (0x13) from reading device data stream Ask Question Asked 13 years ago Modified 13 years ago Viewed 3k times 1I have written a Linux app to read & write binary data to a remote device over a USB port that is emulating a serial port.
When I read data from the device, I have a USB sniffer that shows a binary data stream like this (0x01, 0x0A......0x13), but when my program reads the bytes, the 0x13 is not in the byte stream - this is the XOFF char, but I am not using XON/XOFF flow control (I think).
Tried both open read and write, as well as fopen fread and fwrite in binary mode, same result. Any ideas?
Share Improve this question Follow edited Nov 10, 2011 at 6:36 glglgl 90.9k13 gold badges154 silver badges228 bronze badges asked Nov 9, 2011 at 19:42 user1038375user1038375 211 silver badge3 bronze badges 1- could it be a checksum byte that the serial-over-USB protocol adds? – David Winant Commented Nov 10, 2011 at 0:03
2 Answers
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 1Thanks for any responses, like the website. Turns out stty showed:
# stty -F /dev/ttyUSB0 speed 115200 baud; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 0; time = 10; -brkint -imaxbel -opost -isig -icanon -echo -echoeEven though it looked like flow control was off, The solution was to use cfmakeraw settings to see ALL characters and ignore nothing.
cfmakeraw() sets the terminal to something like the "raw" mode of the old Version 7 terminal driver: input is available character by character, echoing is disabled, and all special processing of terminal input and output characters is disabled. The terminal attributes are set as follows:
termios_p->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); termios_p->c_oflag &= ~OPOST; termios_p->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); termios_p->c_cflag &= ~(CSIZE | PARENB); termios_p->c_cflag |= CS8;Can see all my data now :)
Share Improve this answer Follow answered Nov 10, 2011 at 15:43 user1038375user1038375 211 silver badge3 bronze badges Add a comment | 0Maybe it's better to avoid control characters being sent through serial port at all, and instead slightly modify app on Linux and remote device to encode/decode them into/from two bytes. For example:
0x00 0x00 -> 0x00 0x00 0x01 -> 0x13 (escape XOFF) 0x00 0x02 -> 0x11 (escape XON)Considering the probability of appearing of these 3 bytes in a binary stream this shouldn't decrease the overall throughput I think.
And by the way, XON/XOFF is a software flow control and basic function of serial/terminal drivers. Actually this function can be useful in your case too - to avoid buffers overflow and missing some valuable bytes you can pause (XOFF) or resume (XON) transmission.
Share Improve this answer Follow edited Nov 10, 2011 at 6:12 answered Nov 10, 2011 at 6:04 pmodpmod 11k1 gold badge39 silver badges56 bronze badges Add a comment |Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged
or ask your own question.- The Overflow Blog
- Your docs are your infrastructure
- Featured on Meta
- More network sites to see advertising test [updated with phase 2]
- We’re (finally!) going to the cloud!
- Call for testers for an early access release of a Stack Overflow extension...
Linked
-1 code won't run after compilation on kaliRelated
2 Read() function doesnt read the entire data on serial communication 4 Serial communication: 0x0D is replaced by 0x0A during transmission 0 Debugging of a simple char driver failing on container_of when reading from device attribute 1 Receive extra null byte when using serial port 0 Linux serial read() extraneous data 2 Serial communication on Linux with flow control enabled - bad behaviour 3 Reading data from different UART drivers 0 Linux Serial Port: missing data on input 2 Linux device driver called with wrong count 2 Fail to get data struct from serial portHot Network Questions
- Is Holy Terra Earth?
- Why is Ukraine's conscription age (still) so high (25)?
- What powers do police have to force people onto trains?
- What is 擦边 as in the case of the athlete champion turned dancer?
- Is it possible to add arbitrary amounts of quantum resistance cheaply?
- Is there a symbol for the Hyper key?
- Is Isaiah's suffering servant the prophet Jeremiah?
- Why didn't Steve Zahn receive a credit for Silo?
- Wouldn't the ban of TikTok violate freedom of speech?
- Configure Linux to regularly sync cached data to disk
- How important is storytelling when submitting a grant application (or even a science paper)?
- In GR, what is Gravity? A force or curvature of spacetime?
- Student is almost always late, and expects me to re-explain everything he missed
- Should sudo ask for root password?
- Weapon Mastery and Weapon Cantrips
- Table structure with multiple foreign keys and values
- How do I go about rebranding a fully deleted project that used to have a GNU General Public License v3.0 but is now fully inaccessible
- "Elegant" conditions on two quadratics (with positive real roots) to ensure that the larger root of one is less than the smaller root of the other
- What is this insect found in an apartment in Brazil?
- It will not last
- Is there any advantage to using gifts to avoid estate tax?
- A novel about Earth crossing a toxic cloud of cosmic size
- Can you make 5 x 3 “magic” rectangles?
- Does length contraction "break the speed limit"?
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-cTừ khóa » C 0x13
-
SYS_ERRNO (0x13) - Compiler User Guide - Keil
-
Hi Guys! If Constant 0x13 And 'c' Are Char Type What Will Be Printf ...
-
[PDF] C: Pointers And Arrays
-
Virtual-Key Codes (Winuser.h) - Win32 Apps | Microsoft Docs
-
Crackme3 - GitHub
-
ARM Compiler Toolchain Developing Software For ARM Processors ...
-
4. Understanding The RTPS Packet Format - RTI Community
-
[SOLVED] Failed To Connect To ESP32: Timed Out Waiting For Packet ...
-
Security-Oriented C Tutorial 0x13 - Pieces Of A Puzzle - Null Byte
-
BUSINESS Kabelklemme CLIK C 1-6 0X13 MP Gelb PVC 3mm 4 ...
-
"C [+0x333e3] Tsi_EmergencyShutDown+0x13" When ...
-
0X13 To Decimal