Class: LIBUSB::Bos::SsUsbDeviceCapability

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

Overview

A structure representing the SuperSpeed USB Device Capability descriptor This descriptor is documented in section 9.6.2.2 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) ⇒ SsUsbDeviceCapability

Returns a new instance of SsUsbDeviceCapability.



121
122
123
124
125
# File 'lib/libusb/bos.rb', line 121

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

  register_context(ctx, :libusb_free_ss_usb_device_capability_descriptor)
end

Instance Method Details

#bFunctionalitySupportInteger

The lowest speed at which all the functionality supported by the device is available to the user. For example if the device supports all its functionality when connected at full speed and above then it sets this value to 1.

0 - low speed 1 - full speed 2 - high speed 3 - super speed

Returns:

  • (Integer)


177
178
179
# File 'lib/libusb/bos.rb', line 177

def bFunctionalitySupport
  self[:bFunctionalitySupport]
end

#bm_ltm_support?Boolean

Returns Supports Latency Tolerance Messages (LTM).

Returns:

  • (Boolean)

    Supports Latency Tolerance Messages (LTM)



138
139
140
# File 'lib/libusb/bos.rb', line 138

def bm_ltm_support?
  (bmAttributes & BM_LTM_SUPPORT) != 0
end

#bmAttributesInteger

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.

Returns:

  • (Integer)

See Also:



133
134
135
# File 'lib/libusb/bos.rb', line 133

def bmAttributes
  self[:bmAttributes]
end

#bU1DevExitLatInteger

Returns U1 Device Exit Latency.

Returns:

  • (Integer)

    U1 Device Exit Latency.



182
183
184
# File 'lib/libusb/bos.rb', line 182

def bU1DevExitLat
  self[:bU1DevExitLat]
end

#bU2DevExitLatInteger

Returns U2 Device Exit Latency.

Returns:

  • (Integer)

    U2 Device Exit Latency.



187
188
189
# File 'lib/libusb/bos.rb', line 187

def bU2DevExitLat
  self[:bU2DevExitLat]
end

#inspectObject



142
143
144
145
146
147
# File 'lib/libusb/bos.rb', line 142

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

#supported_speedsArray<Symbol>

Returns speeds supported by this device when operating in SuperSpeed mode Call::SupportedSpeeds.

Returns:

  • (Array<Symbol>)

    speeds supported by this device when operating in SuperSpeed mode Call::SupportedSpeeds



160
161
162
163
164
165
# File 'lib/libusb/bos.rb', line 160

def supported_speeds
  speeds = Call::SupportedSpeeds.to_h.map do |k,v|
    (wSpeedSupported & v) != 0 ? k : nil
  end
  speeds.compact
end

#wSpeedSupportedInteger

Bitmap encoding of the speed supported by this device when operating in SuperSpeed mode.

Returns:

  • (Integer)

See Also:



154
155
156
# File 'lib/libusb/bos.rb', line 154

def wSpeedSupported
  self[:wSpeedSupported]
end