blog

技術|USB IDレポジトリを使ってLinux上でより多くのデバイスを識別する

これは、すべての既知のUSBデバイスIDを含むオープンソースプロジェクトです。...

Nov 3, 2025 · 6 min. read
シェア

これは、すべての既知のUSBデバイスIDを含むオープンソースプロジェクトです。

キーボード、スキャナー、プリンター、マウスなど、Linuxで動作するUSBデバイスは、市場に何千とあります。これらのベンダーの詳細はUSB IDリポジトリに保存されています。

lsusb

  1. $ lsusb
  2. Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
  3. Bus 001 Device 004: ID 046d:082c Logitech, Inc.
  4. Bus 001 Device 003: ID Kingston Technology
  5. Bus 001 Device 002: ID 86  
  6. Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
  7. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

" は /dev/bus/usb ディレクトリをスキャンせず、与えられたデバイスファイルが属するデバイスの情報のみを表示します。デバイスファイルは /dev/bus/usb/ のようなものでなければなりません。このオプションはvオプションのように詳細な情報を表示しますが、そのためにはrootユーザーである必要があります。"

  1. $ lsusb -D /dev/bus/usb/ |more
  2. Device: ID 86  
  3. Device Descriptor:
  4.   bLength                18
  5.   bDescriptorType         1
  6.   bcdUSB               1.10
  7.   bDeviceClass            0 (Defined at Interface level)
  8.   bDeviceSubClass         0
  9.   bDeviceProtocol         0
  10.   bMaxPacketSize0         8
  11.   idVendor           0x18f8
  12.   idProduct          0x8416
  13.   bcdDevice            1.00
  14.   iManufacturer           0
  15.   iProduct                1
  16.   iSerial                 0
  17.   bNumConfigurations      1
  18.   Configuration Descriptor:
  19.     bLength                 9
  20.     bDescriptorType         2
  21.     wTotalLength           59
  22.     bNumInterfaces          2
  23.     bConfigurationValue     1
  24.     iConfiguration          0
  25.     bmAttributes         0xa0
  26.       (Bus Powered)
  27.       Remote Wakeup
  28.     MaxPower              100mA
  29.     Interface Descriptor:
  30.     bLength                 9
  31.       bDescriptorType         4
  32.       bInterfaceNumber        0
  33.       bAlternateSetting       0
  34.       bNumEndpoints           1
  35.       bInterfaceClass         3 Human Interface Device
  36.       bInterfaceSubClass      1 Boot Interface Subclass
  37.       bInterfaceProtocol      2 Mouse
  38.       iInterface              0
  39.         HID Device Descriptor:

USB ID

そのため、私自身だけでなく、他のLinuxユーザーのためにも、これらのフィールドに入力する方法を考えました。すでにオープンソースのプロジェクトがあることがわかりました:USB ID リポジトリ。これは、USBデバイスで使用されているすべての既知のIDのパブリック・リポジトリで、 USB Utilities含むさまざまなプログラムで、人間が読めるデバイス名を表示するためにも使用されています。

USB IDの更新

USB IDデータベースはusb.idsというファイルに保存されています。このファイルの場所はLinuxディストリビューションによって異なります。

Ubuntu 18.04では、このファイルは /var/lib/usbutilsあります。データベースを更新するには、update-usbidsコマンドを使用します。root権限またはsudoで実行する必要があります。

  1. $ sudo update-usbids

新しいファイルがあれば、ダウンロードされます。現在のファイルはバックアップされ、新しいファイルに置き換えられます:

  1. $ ls -la
  2. total 4118
  3. drwxr-xr-x  2 root root   4096 Jan .
  4. drwxr-xr-x 85 root root   4096 Nov  7 08:05 ..
  5. -rw-r--r--  1 root root Jan  9 15:34 usb.ids
  6. -rw-r--r--  1 root root Jan usb.ids.old

Fedora Linux の最新バージョンは、データベースファイルを /usr/share/hwdata に保持します。また、更新スクリプトもありません。代わりに、データベースは hwdata と呼ばれるパッケージによって管理されています。

  1. # dnf info hwdata
  2. Installed Packages
  3. Name         : hwdata
  4. Version      : 0.233
  5. Release      : 1.fc31
  6. Architecture : noarch
  7. Size         : 7.5 M
  8. Source       : hwdata-0.332-1.fc31.src.rpm
  9. Repository   : @System
  10. From repo    : updates
  11. Summary      : Hardware identification and configuration data
  12. URL          : https://.//ta
  13. License      : GPLv2+
  14. Description  : hwdata contains various hardware identification and configuration data,
  15.              : such as the pci.ids and usb.ids databases.
  1. $ lsusb
  2. Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
  3. Bus 001 Device 004: ID 046d:082c Logitech, Inc. HD Webcam C516
  4. Bus 001 Device 003: ID Kingston Technology
  5. Bus 001 Device 014: ID 86 [Maxxter]
  6. Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
  7. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

倉庫が新規および既存の機器の詳細を定期的に更新しているため、他の機器の説明が変更されていることにお気づきかもしれません。

新しいデータの提出

新しいデータを提出するには、ウェブサイトを使う方法と、特別にフォーマットしたパッチファイルをメールで送る方法の2つがあります。はじめに投稿のガイドラインを読みました。まず、アカウントを登録し、プロジェクトの投稿システムを使ってマウスのIDと名前を入力する必要がありました。USBデバイスを追加する手順は同じです。

Read next