USBガジェットにエンドポイントを追加してアドレスを変更するには?

USBガジェットにエンドポイントを追加してアドレスを変更するには?

私はLinuxオペレーティングシステムでシリアル通信用の一括入力および一括出力機能を備えたUSBガジェットを作成しようとしています。しかし、デバイス記述子を設定するのに苦労しています。具体的には、エンドポイントの数やそのアドレスが何であるかなどのパラメータを決定したいが、そうすることはできません。

内容の下 /sys/kernel/config/usb_gadget/ 私が作るg1フォルダ使用量mkdir g1注文する

その後、私はこれを見ました。

  UDC              bDeviceSubClass  bcdUSB           idProduct        os_desc
  bDeviceClass     bMaxPacketSize0  configs          idVendor         strings
  bDeviceProtocol  bcdDevice        functions        max_speed

このウェブサイトのパラメータを設定しました。https://docs.kernel.org/usb/gadget_configfs.html

その後、ボードをUbuntu PCに接続し、次の記述子を見ました。lsusb -d 2020:1111 -v 注文する

 Bus 003 Device 045: ID 2020:1111 VIA Labs, Inc.          USB2.0 Hub             
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.10
      bDeviceClass            0 
      bDeviceSubClass         0 
      bDeviceProtocol         0 
      bMaxPacketSize0        64
      idVendor           0x2020 
      idProduct          0x1111 
      bcdDevice            0.00
      iManufacturer           1 Manufacturer
      iProduct                2 Product
      iSerial                 3 0
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength       0x0020
        bNumInterfaces          1
        bConfigurationValue     1
        iConfiguration          4 0
        bmAttributes         0xa0
          (Bus Powered)
          Remote Wakeup
        MaxPower              100mA
        Interface Descriptor:
          bLength                 9
          bDescriptorType         4
          bInterfaceNumber        0
          bAlternateSetting       0
          bNumEndpoints           2
          bInterfaceClass       255 Vendor Specific Class
          bInterfaceSubClass      0 
          bInterfaceProtocol      0 
          iInterface              0 
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x81  EP 1 IN
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0200  1x 512 bytes
            bInterval               0
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x01  EP 1 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0200  1x 512 bytes
            bInterval               0
    Binary Object Store Descriptor:
      bLength                 5
      bDescriptorType        15
      wTotalLength       0x0016
      bNumDeviceCaps          2
      USB 2.0 Extension Device Capability:
        bLength                 7
        bDescriptorType        16
        bDevCapabilityType      2
        bmAttributes   0x0000010e
          BESL Link Power Management (LPM) Supported
        BESL value      256 us 
      SuperSpeed USB Device Capability:
        bLength                10
        bDescriptorType        16
        bDevCapabilityType      3
        bmAttributes         0x00
        wSpeedsSupported   0x000f
          Device can operate at Low Speed (1Mbps)
          Device can operate at Full Speed (12Mbps)
          Device can operate at High Speed (480Mbps)
          Device can operate at SuperSpeed (5Gbps)
        bFunctionalitySupport   1
          Lowest fully-functional device speed is Full Speed (12Mbps)
        bU1DevExitLat          10 micro seconds
        bU2DevExitLat         511 micro seconds
    can't get debug descriptor: Resource temporarily unavailable
    Device Status:     0x0001
      Self Powered

今まではそんなに良くなった。

問題は、この記述子にエンドポイントが2つありますが、その数を4に増やし、私が直接提供したエンドポイントアドレスを書きたいということです。私がしたいことの例は次のとおりです。エンドポイントは EP1(OUT) EP1(IN) 0x81, 0x01 ではなく EP2(OUT) EP4(OUT) EP6(IN) EP8(IN) となり、各アドレスを設定したいと思います。それぞれ0x02、0x04、0x86、0x88に設定する必要がありますが、どうすればよいですか?

ありがとうございます。

ベストアンサー1

おすすめ記事