了解串行端口设备的ioreg结果

时间:2019-11-03 10:08:04

标签: macos terminal serial-port serial-communication

对于我的serial communication toolbox,我想使用macOS的内置bash /终端功能。但是,我找不到ioreg命令的“适当的”文档,而且man ioreg也不容易理解。例如,命令:

ioreg -r -c IOUSBHostDevice -l

以“分层注册表结构倒置树”的格式返回Arduino Uno的以下结果:

+-o Arduino Uno@14100000  <class IOUSBHostDevice, id 0x100001201, registered, matched, active, busy 0 (3913 ms), retain 25>
  | {
  |   "sessionID" = 17679814164580
  |   "USBSpeed" = 1
  |   "IOServiceLegacyMatchingRegistryID" = 4294971907
  |   "idProduct" = 67
  |   "bDeviceClass" = 2
  |   "IOPowerManagement" = {"PowerOverrideOn"=Yes,"CapabilityFlags"=32768,"MaxPowerState"=2,"DevicePowerState"=2,"ChildrenPowerState"=1,"DriverPowerState"=0,"CurrentPowerState"=2}
  |   "bcdDevice" = 1
  |   "USB Product Name" = "Arduino Uno"
  |   "AppleUSBAlternateServiceRegistryID" = 4294971907
  |   "locationID" = 336592896
  |   "kUSBSerialNumberString" = "7563331313335171B150"
  |   "bDeviceSubClass" = 0
  |   "kUSBCurrentConfiguration" = 1
  |   "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
  |   "bDeviceProtocol" = 0
  |   "USBPortType" = 0
  |   "USB Vendor Name" = "Arduino Srl            "
  |   "idVendor" = 10755
  |   "USB Serial Number" = "7563331313335171B150"
  |   "IOGeneralInterest" = "IOCommand is not serializable"
  |   "kUSBVendorString" = "Arduino Srl            "
  |   "IOClassNameOverride" = "IOUSBDevice"
  | }
  | 
  +-o AppleUSBHostLegacyClient  <class AppleUSBHostLegacyClient, id 0x100001204, !registered, !matched, active, busy 0, retain 8>
  |   {
  |     "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=1,"CapabilityFlags"=65536,"MaxPowerState"=2,"DriverPowerState"=1}
  |   }
  |   
  +-o AppleUSBCDCCompositeDevice  <class AppleUSBCDCCompositeDevice, id 0x10000120a, !registered, !matched, active, busy 0, retain 4>
  |   {
  |     "IOProbeScore" = 58000
  |     "CFBundleIdentifier" = "com.apple.driver.usb.cdc"
  |     "IOProviderClass" = "IOUSBHostDevice"
  |     "IOClass" = "AppleUSBCDCCompositeDevice"
  |     "bDeviceSubClass" = "*"
  |     "IOMatchCategory" = "IODefaultMatchCategory"
  |     "kUSBPreferredConfiguration" = 1
  |     "bDeviceClass" = 2
  |     "bDeviceProtocol" = "*"
  |   }
  |   
  +-o IOUSBHostInterface@0  <class IOUSBHostInterface, id 0x10000120b, registered, matched, active, busy 0 (2 ms), retain 10>
  | | {
  | |   "USBPortType" = 0
  | |   "IOCFPlugInTypes" = {"2d9786c6-9ef3-11d4-ad51-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
  | |   "bcdDevice" = 1
  | |   "USBSpeed" = 1
  | |   "idProduct" = 67
  | |   "bConfigurationValue" = 1
  | |   "bInterfaceSubClass" = 2
  | |   "locationID" = 336592896
  | |   "IOGeneralInterest" = "IOCommand is not serializable"
  | |   "IOServiceLegacyMatchingRegistryID" = 4294971917
  | |   "IOClassNameOverride" = "IOUSBInterface"
  | |   "AppleUSBAlternateServiceRegistryID" = 4294971917
  | |   "idVendor" = 10755
  | |   "bInterfaceProtocol" = 1
  | |   "bAlternateSetting" = 0
  | |   "bInterfaceNumber" = 0
  | |   "bInterfaceClass" = 2
  | | }
  | | 
  | +-o AppleUSBACMControl  <class AppleUSBACMControl, id 0x100001213, registered, matched, active, busy 0 (0 ms), retain 7>
  |     {
  |       "IOProbeScore" = 60000
  |       "CFBundleIdentifier" = "com.apple.driver.usb.cdc.acm"
  |       "IOProviderClass" = "IOUSBHostInterface"
  |       "IOClass" = "AppleUSBACMControl"
  |       "bInterfaceClass" = 2
  |       "IOMatchCategory" = "IODefaultMatchCategory"
  |       "bInterfaceSubClass" = 2
  |       "bInterfaceProtocol" = 1
  |     }
  |     
  +-o IOUSBHostInterface@1  <class IOUSBHostInterface, id 0x10000120c, registered, matched, active, busy 0 (3911 ms), retain 7>
    | {
    |   "USBPortType" = 0
    |   "IOCFPlugInTypes" = {"2d9786c6-9ef3-11d4-ad51-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
    |   "Product Name" = "Arduino Uno"
    |   "bcdDevice" = 1
    |   "USBSpeed" = 1
    |   "idProduct" = 67
    |   "bConfigurationValue" = 1
    |   "bInterfaceSubClass" = 0
    |   "locationID" = 336592896
    |   "IOGeneralInterest" = "IOCommand is not serializable"
    |   "IOServiceLegacyMatchingRegistryID" = 4294971919
    |   "IOClassNameOverride" = "IOUSBInterface"
    |   "AppleUSBAlternateServiceRegistryID" = 4294971919
    |   "idVendor" = 10755
    |   "bInterfaceProtocol" = 0
    |   "bAlternateSetting" = 0
    |   "bInterfaceNumber" = 1
    |   "bInterfaceClass" = 10
    | }
    | 
    +-o AppleUSBACMData  <class AppleUSBACMData, id 0x100001216, registered, matched, active, busy 0 (0 ms), retain 6>
      | {
      |   "IOClass" = "AppleUSBACMData"
      |   "CFBundleIdentifier" = "com.apple.driver.usb.cdc.acm"
      |   "IOProviderClass" = "IOUSBHostInterface"
      |   "IOTTYBaseName" = "usbmodem"
      |   "idProduct" = 67
      |   "IOProbeScore" = 49999
      |   "bInterfaceSubClass" = 0
      |   "HiddenPort" = Yes
      |   "IOMatchCategory" = "IODefaultMatchCategory"
      |   "idVendor" = 10755
      |   "IOTTYSuffix" = "14101"
      |   "bInterfaceClass" = 10
      | }
      | 
      +-o IOSerialBSDClient  <class IOSerialBSDClient, id 0x100001217, registered, matched, active, busy 0 (0 ms), retain 5>
          {
            "IOClass" = "IOSerialBSDClient"
            "CFBundleIdentifier" = "com.apple.iokit.IOSerialFamily"
            "IOProviderClass" = "IOSerialStreamSync"
            "IOTTYBaseName" = "usbmodem"
            "IOSerialBSDClientType" = "IORS232SerialStream"
            "IOProbeScore" = 1000
            "IOCalloutDevice" = "/dev/cu.usbmodem14101"
            "IODialinDevice" = "/dev/tty.usbmodem14101"
            "IOMatchCategory" = "IODefaultMatchCategory"
            "IOTTYDevice" = "usbmodem14101"
            "IOResourceMatch" = "IOBSD"
            "IOTTYSuffix" = "14101"
          }

我很难理解。我想了解的部分是:

  • 这些子分支是什么?
+-o Arduino Uno
  | 
  +-o AppleUSBHostLegacyClient
  |   
  +-o AppleUSBCDCCompositeDevice
  |   
  +-o IOUSBHostInterface@0
  | | 
  | +-o AppleUSBACMControl
  |     
  +-o IOUSBHostInterface@1
    | 
    +-o AppleUSBACMData
      | 
      +-o IOSerialBSDClient 
  • IOPowerManagement属性/标记及其子属性PowerOverrideOnCapabilityFlagsMaxPowerStateDevicePowerStateChildrenPowerStateDriverPowerStateCurrentPowerState是什么意思? People使用此属性来检测Mac屏幕是否处于打开或睡眠状态,我想知道那里是否也有关于串行设备的有用信息。

  • 我想知道是否有关于最大波特率,最大硬件/软件缓冲区大小的信息...我无法从sttysystem_profilerkextstat

如果您能帮助我理解上述结果并找到所需的信息,我们将不胜感激。感谢您的提前支持。

0 个答案:

没有答案