首页 \ 问答 \ Linux - 与设备关联的端口(Linux - port associated to a device)

Linux - 与设备关联的端口(Linux - port associated to a device)

我有一个开发板通过USB连接到我的Linux机器。 为了调试我想监视串口。 我的问题是我不知道应该如何理解我应该监视哪个串口。

在终端中运行lsusb时,我明白了

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0461:4e1d Primax Electronics, Ltd 
Bus 001 Device 004: ID 0d28:0204 NXP LPC1768
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 046d:c019 Logitech, Inc. Optical Tilt Wheel Mouse
Bus 003 Device 002: ID 03f0:c511 Hewlett-Packard 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

我感兴趣的设备是NXP LPC1768,因此它“连接”到设备04的Bus01。但是,我应该监控哪个端口来读取该NXP LPC1768设备的串行端口?

运行dmesg | grep tty 我明白了

[    0.000000] console [tty0] enabled
[   97.204143] cdc_acm 1-1.2:1.1: ttyACM0: USB ACM device

但这仍然没有给我那些我正在寻找的信息。

当我使用Windows时,我会转到设备管理器,端口选项卡,查看与设备关联的COM端口,并使用Putty等软件监控串口。

你怎么能在Linux中做到这一点?

我很抱歉,如果之前已经问过这个问题,但我已经搜索了一个小时但仍然找不到答案..


I have one development board attached via USB to my Linux machine. For the sake of debugging I want to monitor the serial port. My problem is that I don't know how understand which serial port should I monitor.

When running lsusb in the terminal, I see

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0461:4e1d Primax Electronics, Ltd 
Bus 001 Device 004: ID 0d28:0204 NXP LPC1768
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 046d:c019 Logitech, Inc. Optical Tilt Wheel Mouse
Bus 003 Device 002: ID 03f0:c511 Hewlett-Packard 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The device I am interested in is the NXP LPC1768,so it is "attached" to Bus01, device 04. However, which port should I monitor to read the serial port of that NXP LPC1768 device?

When running dmesg | grep tty, I see

[    0.000000] console [tty0] enabled
[   97.204143] cdc_acm 1-1.2:1.1: ttyACM0: USB ACM device

but this still doesn't give me that information I am looking for.

When I used Windows, I would go to the Device manager, Ports tab, see the COM port associated to the device and use software like Putty for monitoring the serial port.

Do you how can I do that in Linux?

I'm sorry if this question has been asked before but I've searched for an hour and still couldn't find the answer..


原文:https://stackoverflow.com/questions/39632508
更新时间:2021-12-07 08:12

最满意答案

从代码中删除了大量的marginpadding

增加position: relative;text-align: center;width: 100%;#nav

另外,增加margin:0;padding:0;*

注意:由于某种原因,你没有img in li

改为:

*{
    margin:0;
    padding:0;
}
#nav {
    position: relative;
    top: 0;
    height: 3em;
    line-height: 3em;
    text-align: center;
    width: 100%;
}
#nav ul {
    margin: 0;
}
#nav ul li {
    display: inline-block;
    font-size: 0.9em;
}
#nav ul li a {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 3em;
    line-height: 3em;
    padding: 0 0.5em 0 0.5em;
    outline: 0;
}

用于悬停下划线。

尝试这个:

#nav ul li a:hover {
    border-bottom: 3px solid #eee;
}

JSFiddle演示


Removed a lot of margin and padding from your code.

Added position: relative;, text-align: center;, width: 100%; to #nav.

Also, Added margin:0; and padding:0; to *

Note: You didn't have img in li for some reason.

Change to this:

*{
    margin:0;
    padding:0;
}
#nav {
    position: relative;
    top: 0;
    height: 3em;
    line-height: 3em;
    text-align: center;
    width: 100%;
}
#nav ul {
    margin: 0;
}
#nav ul li {
    display: inline-block;
    font-size: 0.9em;
}
#nav ul li a {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 3em;
    line-height: 3em;
    padding: 0 0.5em 0 0.5em;
    outline: 0;
}

For underline on hover.

Try this:

#nav ul li a:hover {
    border-bottom: 3px solid #eee;
}

JSFiddle Demo

相关问答

更多
  • 删除所有max-width: 110px; 来自#header .logo属性,然后在样式表中包含以下代码: .logo a img{ width: 110px; } .logo{ margin: 0 !important; } .header-main .container{ padding-top: 0 !important; } Remove all max-width: 110px; properties from #header .logo and then includ ...
  • 此行为在模板中是硬编码的。 当我们编辑副本时 : 在设计器窗口中右键单击您的元素(不在Xaml-Code中),然后单击“编辑模板...”和“编辑副本...” 我们在ExpanderLeftHeaderStyle找到相关代码