简体   繁体   English

OS X 是否有等效的 lsusb

[英]Is there an equivalent of lsusb for OS X

This question seems to be all over google, but the answers all point to using System Profiler.这个问题似乎遍布谷歌,但答案都指向使用 System Profiler。 That's nice, but with System Profiler all you get is something that looks like this:这很好,但是使用 System Profiler,您得到的只是如下所示的内容:

            DasKeyboard:

              Product ID: 0x1919
              Vendor ID: 0x04d9  (Holtek Semiconductor, Inc.)
              Version: 1.06
              Speed: Up to 1.5 Mb/sec
              Location ID: 0x1d114000 / 11
              Current Available (mA): 500
              Current Required (mA): 100

            USB2.0 Hub:

              Product ID: 0x0608
              Vendor ID: 0x05e3  (Genesys Logic, Inc.)
              Version: 32.98
              Speed: Up to 480 Mb/sec
              Location ID: 0x1d113000 / 10
              Current Available (mA): 500
              Current Required (mA): 100

                Microsoft Basic Optical Mouse v2.0 :

                  Product ID: 0x00cb
                  Vendor ID: 0x045e  (Microsoft Corporation)
                  Version: 1.99
                  Speed: Up to 1.5 Mb/sec
                  Manufacturer: Microsoft 
                  Location ID: 0x1d113200 / 12
                  Current Available (mA): 500
                  Current Required (mA): 100

That's great if all you want are the contents of a bunch of device descriptors, but lsusb gives you so much more - information on interfaces and endpoints, interface associations, composite devices... where can you find this information in OS X?如果您想要的只是一堆设备描述符的内容,那就太好了,但是lsusb可以为您提供更多信息 - 有关接口和端点、接口关联、复合设备的信息……在 OS X 中的哪里可以找到这些信息? There must be a tool that does this?必须有一个工具可以做到这一点?

I got tired of forgetting the system_profiler SPUSBDataType syntax, so I made an lsusb alternative. 我厌倦了忘记system_profiler SPUSBDataType语法,所以我做了一个lsusb替代方案。 You can find it here , or install it with homebrew: 你可以在这里找到它,或者用自制软件安装它:

brew install lsusb

我通常运行此命令列出Mac OS X上的USB设备,以及有关它们的详细信息:

ioreg -p IOUSB -l -w 0

Homebrew users: you can get lsusb by installing usbutils formula from my tap: Homebrew用户:你可以通过我的tap上安装usbutils公式获得lsusb

brew install mikhailai/misc/usbutils

It installs the REAL lsusb based on Linux sources (version 007). 它安装了基于Linux源(版本007)的REAL lsusb

在mac osx中,您可以使用以下命令:

system_profiler SPUSBDataType

If you are a user of MacPorts , you may simply install usbutils 如果您是MacPorts的用户,则可以直接安装usbutils

sudo port install usbutils

If you are not, this might be a good opportunity to install it, it has ports for several other useful linux tools. 如果你不是,这可能是一个安装它的好机会,它有几个其他有用的linux工具的端口。

How about ioreg ? ioreg怎么样? The output's much more detailed than the profiler, but it's a bit dense. 输出比分析器更详细,但它有点密集。

Source: https://lists.macosforge.org/pipermail/macports-users/2008-July/011115.html 资料来源: https//lists.macosforge.org/pipermail/macports-users/2008-July/011115.html

system_profiler SPUSBDataType

你需要在macos上命令

至少在system_profiler SPUSBDataType上,当新的USB设备插入时, system_profiler SPUSBDataType输出不会动态更新,而ioreg -p IOUSB -l -w 0动态更新。

On Mac OS X, the Xcode developer suite includes the USB Proper.app application. 在Mac OS X上,Xcode开发套件包括USB Proper.app应用程序。 This is found in /Developer/Applications/Utilities/. 这可以在/ Developer / Applications / Utilities /中找到。 USB Prober will allow you to examine the device and interface descriptors. USB Prober将允许您检查设备和接口描述符。

I'll through my hat into this having tried the answers here.我会通过我的帽子来尝试这里的答案。 The lsusb script is barely working and the macOS port of usbutils doesn't capture string descriptors or support --tree . lsusb脚本几乎无法正常工作, usbutils的 macOS 端口不捕获字符串描述符或不支持--tree

It lead me to create cyme , a modern cross-platform USB list tool using system_profiler -json under the hood.它引导我创建cyme ,这是一个现代跨平台 USB 列表工具,在后台使用system_profiler -json It also uses libusb for extra data/cross-platform and udev on Linux. It supports --lsusb compatible mode, which near matches lsusb 's output for all args.它还将libusb用于额外数据/跨平台和 Linux 上的udev 。它支持--lsusb兼容模式,几乎匹配lsusb的 output 的所有参数。 It should scratch the macOS lsusb itch and more.它应该解决 macOS lsusb等问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM