linux检查/ dev / sdax和/ dev / ttyxxx是否适用于同一设备

时间:2012-01-27 18:19:55

标签: linux posix

我的usb设备有一个串口和一个挂载点,所以我的/ dev文件夹中有一个/dev/sdax/dev/ttyxxx,我该如何找出/dev/sdax/dev/ttyxxx是针对linux中的同一设备吗?

1 个答案:

答案 0 :(得分:0)

如果您有这些目录,请查看/dev/disk/by-path/dev/serial/by-path。比如我有:

/dev/disk/by-path:
total 0
lrwxrwxrwx 1 root root  9 Jan 28 18:10 pci-0000:00:1d.7-usb-0:1:1.3-scsi-0:0:0:0 -> ../../sr0
lrwxrwxrwx 1 root root  9 Jan 28 18:10 pci-0000:00:1d.7-usb-0:1:1.4-scsi-0:0:0:0 -> ../../sdb
lrwxrwxrwx 1 root root  9 Jan  7 10:54 pci-0000:00:1f.2-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Jan  7 10:54 pci-0000:00:1f.2-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Jan  7 10:54 pci-0000:00:1f.2-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Jan  7 10:54 pci-0000:00:1f.2-scsi-0:0:0:0-part3 -> ../../sda3

/dev/serial/by-path:
total 0
lrwxrwxrwx 1 root root 13 Jan 28 18:10 pci-0000:00:1d.7-usb-0:1:1.0-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Jan 28 18:10 pci-0000:00:1d.7-usb-0:1:1.1-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Jan 28 18:10 pci-0000:00:1d.7-usb-0:1:1.2-port0 -> ../../ttyUSB2

匹配pci-0000:00:1d.7-usb-0:1:1.*的名称都属于同一物理设备(在本例中为3G调制解调器)。