linux - 如何在 Linux 中添加超过 4 个串行 tty 设备?

标签 linux serial-port linux-device-driver

当我运行命令“dmesg | grep tty”时,它只显示从 0 到 3 的 4 个 ttyS 设备。我使用了#MAKADEV 和 makenode 命令,它们在/dev 文件夹中创建了 ttyS... 文件。所以现在,我无法使用它们,因为它们的属性(例如 MMIO 地址)未设置。我听说过“setserial”命令,但我看不到它设置串行设备 MMIO 地址。那么我有办法做到这一点吗?

这很关键,因为我的电脑有8个串口,我想全部使用。在我的 Linux 中,我只能使用其中的 4 个..

最佳答案

如果您的系统使用驱动程序 8250 来处理串行端口,请检查内核配置文件中的 CONFIG_SERIAL_8250_NR_UARTS 参数。这定义了内核将处理的串行端口的最大数量。

来自 Kconfig对于那个司机:

config SERIAL_8250_NR_UARTS
    int "Maximum number of 8250/16550 serial ports"
    depends on SERIAL_8250
    default "4"
    help
      Set this to the number of serial ports you want the driver
      to support.  This includes any ports discovered via ACPI or
      PCI enumeration and any ports that may be added at run-time
      via hot-plug, or any ISA multi-port serial cards.

config SERIAL_8250_RUNTIME_UARTS
    int "Number of 8250/16550 serial ports to register at runtime"
    depends on SERIAL_8250
    range 0 SERIAL_8250_NR_UARTS
    default "4"
    help
      Set this to the maximum number of serial ports you want
      the kernel to register at boot time.  This can be overridden
      with the module parameter "nr_uarts", or boot-time parameter
      8250.nr_uarts 

很有可能,CONFIG_SERIAL_8250_NR_UARTS 的值在您的系统上仍然是 4。如果是这样,您可以在内核配置中设置一个更大的值并重建内核以使所有端口可用。

请注意,8250.nr_uarts 内核运行时参数只能设置 0 到 CONFIG_SERIAL_8250_NR_UARTS 之间的端口数,因此在启动时设置它是不够的。

关于linux - 如何在 Linux 中添加超过 4 个串行 tty 设备?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26206121/

相关文章:

serial-port - 串行端口上的 TCP/IP

linux -/开发/端口与/开发/内存

linux - 如何测试自己的 Linux 模块?

c++ - 查找 C++ 函数运行所需的时间

linux - 如何让 Linux shell 命令堆栈只存储唯一的命令

linux - 使用 awk 解析在字段中包含逗号的制表符分隔文件

c++ - 我无法从串口发送连续数据

python-2.7 - Python 2.7 : serial. serialutil.SerialException : Port is already open. 如何关闭此端口?

c - Linux内核开发中如何有效迭代

linux -/频繁的unix tee命令如何将stdout终端输出写入文件?如果输出太大