Mac OS X 相当于“udevadm info -a -n /dev/ttyACM0”

Mac OS X 相当于“udevadm info -a -n /dev/ttyACM0”

Mac OS X 中与 Linux 命令对应的命令是什么udevadm info /dev/ttyACM0

/dev/tty.whatever我正在尝试在脚本中获取有关 TTY 设备 () 的 USB 信息。

更新:我正在寻找有关 TTY / 串行端口设备(而不是磁盘)的信息。这是我正在寻找的输出类型(关键字段已突出显示):

[rhwood@localhost ~]$ udevadm info /dev/ttyACM3
P:/设备/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.2/2-2.2:1.0/tty/ttyACM3
N: ttyACM3
S: digitrax-pr3-3
E: DEVLINKS=/dev/digitrax-pr3-3
埃:DEVNAME=/dev/ttyACM3
E:DEVPATH=/设备/pci0000:00/0000:00:11.0/0000:02:00.0/usb2/2-2/2-2.2/2-2.2:1.0/tty/ttyACM3
E: ID_BUS=usb
E: ID_FOR_SEAT=tty-pci-0000_02_00_0-usb-0_2_2_1_0
E: ID_MM_CANDIDATE=1
埃:ID_MODEL=VC0M_端口
E: ID_MODEL_ENC=VC0M\x20Port
埃:ID_MODEL_ID=ff7e
E: ID_PATH=pci-0000:02:00.0-usb-0:2.2:1.0
E: ID_PATH_TAG=pci-0000_02_00_0-usb-0_2_2_1_0
E: ID_REVISION=0001
E: ID_SERIAL=Digitrax_Inc._VC0M_Port
E:ID_TYPE=通用
E:ID_USB_CLASS_FROM_DATABASE=通信
E: ID_USB_DRIVER=cdc_acm
E: ID_USB_INTERFACES=:020201:0a0000:
E: ID_USB_INTERFACE_NUM=00
埃:ID_VENDOR=Digitrax_Inc.
E: ID_VENDOR_ENC=Digitrax\x20Inc.
E:ID_VENDOR_FROM_DATABASE=Microchip Technology, Inc.
埃:ID_VENDOR_ID=04d8
E:主要=166
E:次要=3
E:子系统=tty
E: 标签=:seat:systemd:uaccess:
电子邮件:USEC_INITIALIZED=292186515

我非常有兴趣将DEVNAME/dev/ttyACM3)与VENDORMODEL信息进行匹配。

答案1

我用 python 编写了一个小实用程序,它允许串行端口被制造商等过滤。 https://github.com/dhylands/usb-ser-mon/blob/master/usb_ser_mon/find_port.py

我最近还用 rust 编写了一个串行监视器,它可以使用 --find 或 --list 选项执行类似类型的过滤/列出: https://crates.io/crates/serial-monitor

答案2

我想这就是你要找的东西:

ioreg -lp IOUSB

将 rj45 串行电缆插入我的OSX 10.14.6 MojaveMacbook 的USB-C 端口现报告如下:

+-o FT232R USB UART@14300000  <class AppleUSBDevice, id 0x10000ee76, registered, matched, active, busy 0 (7 ms), retain 14>
    {
      "sessionID" = 573143338571350
      "iManufacturer" = 1
      "bNumConfigurations" = 1
      "idProduct" = 24577
      "bcdDevice" = 1536
      "Bus Power Available" = 250
      "USB Address" = 1
      "bMaxPacketSize0" = 8
      "iProduct" = 2
      "iSerialNumber" = 3
      "bDeviceClass" = 0
      "Built-In" = No
      "locationID" = 338690048
      "bDeviceSubClass" = 0
      "bcdUSB" = 512
      "USB Product Name" = "FT232R USB UART"
      "PortNum" = 3
      "non-removable" = "no"
      "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
      "bDeviceProtocol" = 0
      "IOUserClientClass" = "IOUSBDeviceUserClientV2"
      "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
      "kUSBCurrentConfiguration" = 1
      "Device Speed" = 1
      "USB Vendor Name" = "FTDI"
      "idVendor" = 1027
      "IOGeneralInterest" = "IOCommand is not serializable"
      "USB Serial Number" = "A9I2IIK0"
      "IOClassNameOverride" = "IOUSBDevice"
    }

我知道这篇文章是 (4) 年前发布的,但我发现没人回答。嘿,迟做总比不做好!HTH-

相关内容