본문으로 바로가기

리눅스 lsusb 명령어 사용법(-v,-s,-d,-D,-t,-V)

category 리눅스 (linux)/명령어 2024. 5. 2. 20:31

 : lsusb 명령은 USB 버스관련 정보와 연결된  USB 장치를 리스트 합니다.

 

> 옵션없이 사용시

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 003: ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio
Bus 001 Device 008: ID 303a:1001 Espressif USB JTAG/serial debug unit
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

목차

     

    도표

    옵션 의미
    -v,--verbose 상세한 정보표시 옵션
    -s [bus]:[devnum] [bus]:[devnum] 에 해당하는 장치 표시 , bus, devnum 생략가능합니다.
    -d [vendorId]:[productId] [vendorId] : [productId] 에 해당하는 장치 표시, 생략가능하며 생략시 모든 장치 표시
    -D device device 에 해당하는 장치 표시 옵션으로 device 에는 /dev/bus/usb/xxx/yyy 등이 들어갑니다.
    -t, --tree tree 형식으로 USB 장치 리스트
    -V, --version 버전 표시
    -h, --help 도움말 옵션

     

    옵션

    -v, --verbose

      : 상세정보 디스플레이 옵션

    더보기

    $ lsusb -v -d 303a:1001

    Bus 001 Device 008: ID 303a:1001 Espressif USB JTAG/serial debug unit
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass          239 Miscellaneous Device
      bDeviceSubClass         2
      bDeviceProtocol         1 Interface Association
      bMaxPacketSize0        64
      idVendor           0x303a
      idProduct          0x1001
      bcdDevice            1.02
      iManufacturer           1 Espressif
      iProduct                2 USB JTAG/serial debug unit
      iSerial                 3 40:4C:CA:43:15:18
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength       0x0062
        bNumInterfaces          3
        bConfigurationValue     1
        iConfiguration          0
        bmAttributes         0xc0
          Self Powered
        MaxPower              500mA
        Interface Association:
          bLength                 8
          bDescriptorType        11
          bFirstInterface         0
          bInterfaceCount         2
          bFunctionClass          2 Communications
          bFunctionSubClass       2 Abstract (modem)
          bFunctionProtocol       0
          iFunction               0
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         2 Communications
          bInterfaceSubClass      2 Abstract (modem)
          bInterfaceProtocol      0
          iInterface              0
          CDC Header:
            bcdCDC               1.10
          CDC ACM:
            bmCapabilities       0x02
              line coding and serial state
          CDC Union:
            bMasterInterface        0
            bSlaveInterface         1
          CDC Call Management:
            bmCapabilities       0x03
              call management
              use DataInterface
            bDataInterface          1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x82  EP 2 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        1
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass        10 CDC Data
          bInterfaceSubClass      2
          bInterfaceProtocol      0
          iInterface              0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x01  EP 1 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        2
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass       255 Vendor Specific Class
          bInterfaceSubClass    255 Vendor Specific Subclass
          bInterfaceProtocol      1
          iInterface              0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x02  EP 2 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x83  EP 3 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
    Device Status:     0x0001
      Self Powered

     

    -s [[bus]:][devnum]

      : bus:devnum 에 해당하는 장치를 보여줍니다. bus, devnum 값은 생략 가능합니다.

    더보기
    $ lsusb -s 001:008
    Bus 001 Device 008: ID 303a:1001 Espressif USB JTAG/serial debug unit
    
    $ lsusb -s 001:
    Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
    Bus 001 Device 006: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
    Bus 001 Device 007: ID 10d5:55a4 Uni Class Technology Co., Ltd 4 Port KVMSwicther
    Bus 001 Device 005: ID 0566:3032 Monterey International Corp.
    Bus 001 Device 004: ID 1a40:0101 Terminus Technology Inc. Hub
    Bus 001 Device 003: ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
    $ lsusb -s :001
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
    $ lsusb -s :
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
    Bus 001 Device 006: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
    Bus 001 Device 007: ID 10d5:55a4 Uni Class Technology Co., Ltd 4 Port KVMSwicther
    Bus 001 Device 005: ID 0566:3032 Monterey International Corp.
    Bus 001 Device 004: ID 1a40:0101 Terminus Technology Inc. Hub
    Bus 001 Device 003: ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

     

    -d [vendor]:[product]

     : vendor, product 와 일치하는 장치 표시하기, vendor, prodcut 모두 생략 가능합니다.

    $ lsusb
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
    Bus 001 Device 006: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
    Bus 001 Device 007: ID 10d5:55a4 Uni Class Technology Co., Ltd 4 Port KVMSwicther
    Bus 001 Device 005: ID 0566:3032 Monterey International Corp.
    Bus 001 Device 004: ID 1a40:0101 Terminus Technology Inc. Hub
    Bus 001 Device 003: ID 0bda:8771 Realtek Semiconductor Corp. Bluetooth Radio
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
    $ lsusb -d :0003
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    
    $ lsusb -d 1d6b:
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    
    $ lsusb -d 0566:3032
    Bus 001 Device 005: ID 0566:3032 Monterey International Corp.

     

    -D  device

    더보기

    $ lsusb -D /dev/bus/usb/001/008
    Device: ID 303a:1001 Espressif USB JTAG/serial debug unit
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass          239 Miscellaneous Device
      bDeviceSubClass         2
      bDeviceProtocol         1 Interface Association
      bMaxPacketSize0        64
      idVendor           0x303a
      idProduct          0x1001
      bcdDevice            1.02
      iManufacturer           1 Espressif
      iProduct                2 USB JTAG/serial debug unit
      iSerial                 3 40:4C:CA:43:15:18
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength       0x0062
        bNumInterfaces          3
        bConfigurationValue     1
        iConfiguration          0
        bmAttributes         0xc0
          Self Powered
        MaxPower              500mA
        Interface Association:
          bLength                 8
          bDescriptorType        11
          bFirstInterface         0
          bInterfaceCount         2
          bFunctionClass          2 Communications
          bFunctionSubClass       2 Abstract (modem)
          bFunctionProtocol       0
          iFunction               0
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           1
          bInterfaceClass         2 Communications
          bInterfaceSubClass      2 Abstract (modem)
          bInterfaceProtocol      0
          iInterface              0
          CDC Header:
            bcdCDC               1.10
          CDC ACM:
            bmCapabilities       0x02
              line coding and serial state
          CDC Union:
            bMasterInterface        0
            bSlaveInterface         1
          CDC Call Management:
            bmCapabilities       0x03
              call management
              use DataInterface
            bDataInterface          1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x82  EP 2 IN
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        1
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass        10 CDC Data
          bInterfaceSubClass      2
          bInterfaceProtocol      0
          iInterface              0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x01  EP 1 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        2
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass       255 Vendor Specific Class
          bInterfaceSubClass    255 Vendor Specific Subclass
          bInterfaceProtocol      1
          iInterface              0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x02  EP 2 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x83  EP 3 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
    Device Status:     0x0001
      Self Powered

     

    -t, --tree

      : tree구조로 usb 장치 표시하기

    $ lsusb -t
    /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/8p, 5000M
    /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
        |__ Port 8: Dev 2, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
        |__ Port 10: Dev 8, If 0, Class=Communications, Driver=cdc_acm, 12M
        |__ Port 10: Dev 8, If 1, Class=CDC Data, Driver=cdc_acm, 12M
        |__ Port 10: Dev 8, If 2, Class=Vendor Specific Class, Driver=, 12M
        |__ Port 13: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M
        |__ Port 13: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M

     

     

    -V, --version

      : 버전 정보 표시

    $ lsusb -V
    lsusb (usbutils) 014

     

    -h,--help

    더보기

    $ lsusb --help
    Usage: lsusb [options]...
    List USB devices
      -v, --verbose
          Increase verbosity (show descriptors)
      -s [[bus]:][devnum]
          Show only devices with specified device and/or
          bus numbers (in decimal)
      -d vendor:[product]
          Show only devices with the specified vendor and
          product ID numbers (in hexadecimal)
      -D device
          Selects which device lsusb will examine
      -t, --tree
          Dump the physical USB device hierarchy as a tree
      -V, --version
          Show version of program
      -h, --help
          Show usage and help

     

    <기타>

    ▶현재 연결된 /dev/tty*** 장치찾기

      : /proc/kmsg 실행후 usb 장치를 삽입해 주면 아래처럼 로그가 출력되는데 그중 tty**** 로 부분 검색해 줍니다.

    $ sudo cat /proc/kmsg
    [sudo] password for xxx:
    <6>[ 3182.730162] usb 1-10: USB disconnect, device number 17
    <6>[ 3187.787520] usb 1-10: new full-speed USB device number 18 using xhci_hcd
    <6>[ 3187.937636] usb 1-10: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
    <6>[ 3187.937659] usb 1-10: Product: CP2102N USB to UART Bridge Controller
    <6>[ 3187.937671] usb 1-10: SerialNumber: 3a34076b1359ed11aec7b3301d62bc44
    <6>[ 3187.942845] usb 1-10: cp210x converter now attached to ttyUSB1
    
    
    >> 장치 리셋
    
    <6>[ 3315.157291] usb 1-10: USB disconnect, device number 20
    <6>[ 3315.645431] usb 1-10: new full-speed USB device number 21 using xhci_hcd
    <6>[ 3315.794677] usb 1-10: New USB device found, idVendor=303a, idProduct=1001, bcdDevice= 1.02
    <6>[ 3315.794691] usb 1-10: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    <6>[ 3315.794700] usb 1-10: Product: USB JTAG/serial debug unit
    <6>[ 3315.794706] usb 1-10: Manufacturer: Espressif
    <6>[ 3315.794711] usb 1-10: SerialNumber: 40:4C:CA:43:15:18
    <6>[ 3315.798175] cdc_acm 1-10:1.0: ttyACM0: USB ACM device
    
    >> 로그가 넘 많으면 아래처럼 grep 사용하세요.
    $ sudo cat /proc/kmsg | grep tty
    <6>[28168.185554] cp210x ttyUSB1: cp210x converter now disconnected from ttyUSB1
    
    >> dmesg 를 사용하면 부팅후 연결된 장치를 찾을 수 있습니다.
    $ sudo dmesg | grep tty
    [    0.083704] printk: console [tty0] enabled
    [    0.336563] 00:01: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
    [    2.957095] usb 1-8: FTDI USB Serial Device converter now attached to ttyUSB0
    [28111.962913] usb 1-14: cp210x converter now attached to ttyUSB1
    [28115.982145] cp210x ttyUSB1: cp210x converter now disconnected from ttyUSB1
    [28117.875541] usb 1-14: cp210x converter now attached to ttyUSB1
    [28132.448628] cp210x ttyUSB1: cp210x converter now disconnected from ttyUSB1
    [28135.540216] usb 1-14: cp210x converter now attached to ttyUSB1
    [28137.720267] cp210x ttyUSB1: cp210x converter now disconnected from ttyUSB1
    [28142.653580] usb 1-14: cp210x converter now attached to ttyUSB1
    [28164.795095] cp210x ttyUSB1: cp210x converter now disconnected from ttyUSB1
    [28166.757626] usb 1-14: cp210x converter now attached to ttyUSB1
    [28168.185554] cp210x ttyUSB1: cp210x converter now disconnected from ttyUSB1
    [28172.848717] usb 1-14: cp210x converter now attached to ttyUSB1

     

     

     

    반응형