识别连接的 USB 和内置 USB

发布于 2025-01-03 02:39:31 字数 899 浏览 2 评论 0原文

我已经通过 USB 将 Android 手机连接到 Odroid

现在,当我在 Odroid 上执行“lsusb”时,我会得到以下输出。

总线 001 设备 001:ID 1d6b:0002
总线 002 设备 001:ID 1d6b:0001
总线 001 设备 002:ID 0424:2514
总线 001 设备 004:ID 0bdb:190d
总线 001 设备 005:ID 1004:618e

sys/bus/usb/devices 列表如下,

USB1
1-0:1.0
USB2
2-0:1.0
1-1
1-1:1.0
1-1.1
1-1.1:1.0
1-1.1:1.1
1-1.1:1.2
1-1.1:1.3
1-1.1:1.4
1-1.1:1.5

现在我需要知道哪个是内置的并且 哪一个是连接的...?

手动检查供应商 ID 和产品 ID,我可以看出 lsusb 中的最后一个是我的 Android 手机,并类似地检查“2-0:1.0”内的“uevent”文件强>” 目录。

我以编程方式解析 bDeviceClass、产品、idVendor、产品、制造商和其他内容以获取信息。

但是文件中是否有任何标志或一些额外信息可以告诉我哪个 USB 已连接以及哪个 USB 是内置的?

希望我的问题很清楚。

I have connected a android mobile phone to the Odroid through usb.

Now when I do 'lsusb' on Odroid then I get following output..

Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0001
Bus 001 Device 002: ID 0424:2514
Bus 001 Device 004: ID 0bdb:190d
Bus 001 Device 005: ID 1004:618e

sys/bus/usb/devices list down as follows,

usb1
1-0:1.0
usb2
2-0:1.0
1-1
1-1:1.0
1-1.1
1-1.1:1.0
1-1.1:1.1
1-1.1:1.2
1-1.1:1.3
1-1.1:1.4
1-1.1:1.5

Now i needed to know which one is built-in and
which one is connected one...?

manually checking vendor-id and product id, I could tell that the last one in the lsusb is my android phone and similarly checking the "uevent" file inside "2-0:1.0"
directory.

Programmatically i am parsing bDeviceClass, product, idVendor, product, manufacturer and other things to get the info.

But is there any flag or some extra info in files which tells me which usb is connected and which usb is built-in ?

Hope my question is clear.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仙女 2025-01-10 02:39:31

您可以使用 dmesg 的输出来找出哪个是已连接的

   $ dmesg | grep usb
    [225415.950096] usb 1-1: new high speed USB device using ehci_hcd and address 10
    [225416.104344] usb 1-1: New USB device found, idVendor=0fce, idProduct=2149
    [225416.104358] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [225416.104369] usb 1-1: Product: SEMC HSUSB Device
    [225416.104376] usb 1-1: Manufacturer: SEMC
    [225416.104383] usb 1-1: SerialNumber: 43423531315133584454
    [225416.109151] scsi7 : usb-storage 1-1:1.1
    [226418.198922] usb 1-1: USB disconnect, address 10

You can use output from dmesg to find out which is the connected one

   $ dmesg | grep usb
    [225415.950096] usb 1-1: new high speed USB device using ehci_hcd and address 10
    [225416.104344] usb 1-1: New USB device found, idVendor=0fce, idProduct=2149
    [225416.104358] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [225416.104369] usb 1-1: Product: SEMC HSUSB Device
    [225416.104376] usb 1-1: Manufacturer: SEMC
    [225416.104383] usb 1-1: SerialNumber: 43423531315133584454
    [225416.109151] scsi7 : usb-storage 1-1:1.1
    [226418.198922] usb 1-1: USB disconnect, address 10
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文