RT-Thread / RT-Thread/rt-thread

[Bug] 在串口V2的驱动里面,_serial_poll_tx 这个函数里面,为什么要判断if (putc_result < 0) break;,这样会导致发送中文错误。

Open
#11,392 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

RT-Thread Version

5.2.2

Hardware Type/Architectures

hpm6750

Develop Toolchain

Other

Describe the bug
Image 5.0.2的是这样的,发送的时候没有判断返回值;直接调用发送; Image 5.2.2的增加了返回值小于0直接break了。发送英文字符的时候没问题,但是当发送中文的时候,会转义,现在bsp的驱动是返回的发送字符,导致发送中文字符就丢数据了。如果没有明确说明putc接口返回值定义说明,这样很多bsp这里就会都出问题。 Image
Other additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Serial V2 driver’s _serial_poll_tx function and inspect how putc_result is interpreted. Compare the 5.0.2 and 5.2.2 behavior shown in the report, then check the HPM6750 BSP’s putc return value. Done means the return-value contract is clear and Chinese transmission no longer loses data.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.