5

What is the Mac OS X equivalent of the Linux command udevadm info /dev/ttyACM0?

I am attempting get the USB information about a TTY device (/dev/tty.whatever) in a script.

UPDATE: I'm looking for information about a TTY / serial port device (not a disk). This is the type of output I am looking for (critical fields are highlighted):

[rhwood@localhost ~]$ udevadm info /dev/ttyACM3
P: /devices/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
E: DEVNAME=/dev/ttyACM3
E: DEVPATH=/devices/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
E: ID_MODEL=VC0M_Port
E: ID_MODEL_ENC=VC0M\x20Port
E: 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=generic
E: ID_USB_CLASS_FROM_DATABASE=Communications
E: ID_USB_DRIVER=cdc_acm
E: ID_USB_INTERFACES=:020201:0a0000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=Digitrax_Inc.
E: ID_VENDOR_ENC=Digitrax\x20Inc.
E: ID_VENDOR_FROM_DATABASE=Microchip Technology, Inc.
E: ID_VENDOR_ID=04d8
E: MAJOR=166
E: MINOR=3
E: SUBSYSTEM=tty
E: TAGS=:seat:systemd:uaccess:
E: USEC_INITIALIZED=292186515

I am really interested in matching the DEVNAME (/dev/ttyACM3) to the VENDOR and MODEL information.

2
  • To help make the desired output clearer to understand, what would the actual output of udevadm info -a -n /dev/ttyACM0x be? Can you please edit your question to add that? Feb 26, 2015 at 19:38
  • 1
    @JakeGould Thanks for helping clarify the question. I've removed the -a -n parameters for the udevadm command to get a less verbose output.
    – Randall
    Feb 27, 2015 at 12:09

2 Answers 2

0

I think this is what you're looking for:

ioreg -lp IOUSB

Specimen feedback from plugging in an rj45 serial cable into my OSX 10.14.6 Mojave Macbook's USB-C port is reported below:

+-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"
    }

I know this was posted over (4) year's ago, but noticed nobody answered it. Hey, better late than never! HTH-

4
  • Thanks for answering this. I have (finally!) gotten around to testing it with my own devices. This seems to work fine if the device has a serial number, but not if it doesn't.
    – Randall
    Oct 15, 2019 at 10:54
  • @Randall The -l switch in my specimen command tells ioreg to "show properties for all displayed objects" and the -p switch tells ioreg to "traverse the registry over the specified plane" which in this case is IOUSB. The fact that your device is not being displayed might be down to the fact the machine doesn't see it, rather than being from an empty value in the "USB Serial Number" string. Otherwise, if the system could see it, I believe it should appear in the output of ioreg -lp IOUSB. Maybe try a different USB port and a different Mac to exclude things apart from cable
    – F1Linux
    Oct 15, 2019 at 11:42
  • The device is being displayed. My problem arises from not being able to tie /dev/cu.foo to a device if a serial number is not present in the device’s firmware. If the serial device is present, it seems easy.
    – Randall
    Oct 15, 2019 at 11:49
  • @Randall Try the command without the -p IOUSB switch: I just remarked that if you omit that and just execute ioreg -l the output prints the device, but not the serial number for it. Obviously the output is more verbose as it's not being limited to a single plane, but I guess you could add a grep to screen-scrape the output
    – F1Linux
    Oct 15, 2019 at 12:07
0

I've written a little utility in python which allows the serial ports to be filtered by manufacturers, etc. https://github.com/dhylands/usb-ser-mon/blob/master/usb_ser_mon/find_port.py

I've also recently written a serial monitor in rust, which can do a similar type of filtering/listing using the --find or --list options: https://crates.io/crates/serial-monitor

1
  • pyudev doesn't work on Mac. Oct 28, 2022 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .