Skip to content

[components][drivers] fix posix tty, and add more baudrate #8683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

zmshahaha
Copy link
Contributor

@zmshahaha zmshahaha commented Mar 27, 2024

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

参见https://man7.org/linux/man-pages/man2/ioctl_tty.2.html

当命令cmd为TCGETA等以A结尾,参数应为struct termio *,当命令cmd为TCGETS等以S结尾,参数应为struct termios *

此处参数均以struct termios *解释,故应变为TCGETS/TCSETS等。

部分POSIX函数所设置的波特率不支持,这里添加补充

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@zmshahaha zmshahaha marked this pull request as draft March 27, 2024 07:21
@zmshahaha zmshahaha changed the title [components][drivers] fix posix tty [components][drivers] fix posix tty, and add more baudrate Mar 27, 2024
@zmshahaha zmshahaha marked this pull request as ready for review March 27, 2024 08:30
@mysterywolf mysterywolf requested a review from polarvid March 27, 2024 14:25
@@ -1095,9 +1102,9 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
}
break;

case TCSETAW:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

旧的case需要保留,但可以做个兼容性修正。termio应该是废弃的标准。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

termio 是 SVR4 标准的规范,和 POSIX termios 的主要区别是结构体的类型重名了。而我觉得这些不该是 serial 这层处理的。

因为 termios 是 POSIX 针对终端的规范。在 TTY 这一层,类似 termio 这种非 POSIX 标准的兼容性差异都会被处理。所以有了 tty 这个更高层的协议,驱动是不会看到 termio 这个结构体传下来的。

所以对于支持 POSIX 终端的 smart,serial 这边根本不用考虑这个问题。至于没有 TTY 的 RTOS 里面,个人认为没必要做得那么全,反正本来也没有支持全部的控制命令。

@BernardXiong
Copy link
Member

请解决冲突文件:

Conflicting files
components/drivers/serial/serial.c

@BernardXiong BernardXiong merged commit d856f77 into RT-Thread:master Apr 1, 2024
40 of 42 checks passed
@mysterywolf
Copy link
Member

@zmshahaha 这个PR导致CI aarch64编译不过 请修复

@zmshahaha
Copy link
Contributor Author

zmshahaha commented Apr 2, 2024

@zmshahaha 这个PR导致CI aarch64编译不过 请修复

已在pr #8689 解决

8546c94

@mysterywolf
Copy link
Member

请拆出来 作为一个独立PR,那个PR推进好像还需要讨论。

@zmshahaha
Copy link
Contributor Author

已拆分到

#8721

@zmshahaha zmshahaha deleted the serial branch April 2, 2024 08:00
Rbb666 pushed a commit that referenced this pull request Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants