def device_capabilities
      pp_ext = FFI::MemoryPointer.new :pointer
      caps = []
      # Capabilities are appended to the bos header
      ptr = pointer + offset_of(:dev_capability)
      bNumDeviceCaps.times do
        cap = DeviceCapability.new self, ptr.read_pointer
        case cap.bDevCapabilityType
          when LIBUSB::BT_WIRELESS_USB_DEVICE_CAPABILITY
            # no struct defined in libusb -> use generic DeviceCapability
          when LIBUSB::BT_USB_2_0_EXTENSION
            res = Call.libusb_get_usb_2_0_extension_descriptor(@ctx, cap.pointer, pp_ext)
            cap = Usb20Extension.new(pp_ext.read_pointer) if res==0
          when LIBUSB::BT_SS_USB_DEVICE_CAPABILITY
            res = Call.libusb_get_ss_usb_device_capability_descriptor(@ctx, cap.pointer, pp_ext)
            cap = SsUsbDeviceCapability.new(pp_ext.read_pointer) if res==0
          when LIBUSB::BT_CONTAINER_ID
            res = Call.libusb_get_container_id_descriptor(@ctx, cap.pointer, pp_ext)
            cap = ContainerId.new(pp_ext.read_pointer) if res==0
          else
            # unknown capability -> use generic DeviceCapability
        end
        ptr += FFI.type_size(:pointer)
        caps << cap
      end
      caps
    end
def device_capabilities
      pp_ext = FFI::MemoryPointer.new :pointer
      caps = []
      # Capabilities are appended to the bos header
      ptr = pointer + offset_of(:dev_capability)
      bNumDeviceCaps.times do
        cap = DeviceCapability.new self, ptr.read_pointer
        case cap.bDevCapabilityType
          when LIBUSB::BT_WIRELESS_USB_DEVICE_CAPABILITY
            # no struct defined in libusb -> use generic DeviceCapability
          when LIBUSB::BT_USB_2_0_EXTENSION
            res = Call.libusb_get_usb_2_0_extension_descriptor(@ctx, cap.pointer, pp_ext)
            cap = Usb20Extension.new(pp_ext.read_pointer) if res==0
          when LIBUSB::BT_SS_USB_DEVICE_CAPABILITY
            res = Call.libusb_get_ss_usb_device_capability_descriptor(@ctx, cap.pointer, pp_ext)
            cap = SsUsbDeviceCapability.new(pp_ext.read_pointer) if res==0
          when LIBUSB::BT_CONTAINER_ID
            res = Call.libusb_get_container_id_descriptor(@ctx, cap.pointer, pp_ext)
            cap = ContainerId.new(pp_ext.read_pointer) if res==0
          else
            # unknown capability -> use generic DeviceCapability
        end
        ptr += FFI.type_size(:pointer)
        caps << cap
      end
      caps
    end
bNumDeviceCap Device Capability Descriptors

 @return [Array<Bos::DeviceCapability, Bos::Usb20Extension, Bos::SsUsbDeviceCapability, Bos::ContainerId>]