Class: LIBUSB::Bos::Usb20Extension

Inherits:
FFI::Struct
  • Object
show all
Includes:
GenericMethods
Defined in:
lib/libusb/bos.rb

Overview

A structure representing the USB 2.0 Extension descriptor This descriptor is documented in section 9.6.2.1 of the USB 3.0 specification. All multiple-byte fields are represented in host-endian format.

Instance Method Summary collapse

Methods included from GenericMethods

#bDescriptorType, #bDevCapabilityType, #bLength, #dev_capability_data

Constructor Details

#initialize(ctx, *args) ⇒ Usb20Extension

Returns a new instance of Usb20Extension.



78
79
80
81
82
# File 'lib/libusb/bos.rb', line 78

def initialize(ctx, *args)
  super(*args)

  register_context(ctx, :libusb_free_usb_2_0_extension_descriptor)
end

Instance Method Details

#bm_lpm_support?Boolean

Returns Supports Link Power Management (LPM).

Returns:

  • (Boolean)

    Supports Link Power Management (LPM)



93
94
95
# File 'lib/libusb/bos.rb', line 93

def bm_lpm_support?
  (bmAttributes & BM_LPM_SUPPORT) != 0
end

#bmAttributesObject

Bitmap encoding of supported device level features. A value of one in a bit location indicates a feature is supported; a value of zero indicates it is not supported.



88
89
90
# File 'lib/libusb/bos.rb', line 88

def bmAttributes
  self[:bmAttributes]
end

#inspectObject



97
98
99
100
101
102
# File 'lib/libusb/bos.rb', line 97

def inspect
  attrs = Call::Usb20ExtensionAttributes.to_h.map do |k, v|
    (bmAttributes & v) ? k.to_s : nil
  end
  "\#<#{self.class} #{attrs.compact.join(",")}>"
end