Class: LIBUSB::Bos::SsplusSublinkAttribute

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

Overview

A structure representing a SuperSpeedPlus descriptor attribute

Instance Method Summary collapse

Instance Method Details

#directionObject

This field indicates if this Sublink Speed Attribute defines the receive or transmit bit rate.



226
227
228
# File 'lib/libusb/bos.rb', line 226

def direction
  self[:direction]
end

#exponentObject

This field defines the base 10 exponent times 3, that shall be applied to the mantissa.



214
215
216
# File 'lib/libusb/bos.rb', line 214

def exponent
  self[:exponent]
end

#inspectObject



257
258
259
# File 'lib/libusb/bos.rb', line 257

def inspect
  "\#<#{self.class} #{to_s_human_readable}>"
end

#mantissaObject

This field defines the mantissa that shall be applied to the exponent when calculating the maximum bit rate.



237
238
239
# File 'lib/libusb/bos.rb', line 237

def mantissa
  self[:mantissa]
end

#protocolObject

This field identifies the protocol supported by the link.



232
233
234
# File 'lib/libusb/bos.rb', line 232

def protocol
  self[:protocol]
end

#ssidObject

Sublink Speed Attribute ID (SSID).

This field is an ID that uniquely identifies the speed of this sublink.



208
209
210
# File 'lib/libusb/bos.rb', line 208

def ssid
  self[:ssid]
end

#to_s_human_readableObject



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/libusb/bos.rb', line 241

def to_s_human_readable
  exponents = {
    SSPLUS_ATTR_EXP_BPS: " ",
    SSPLUS_ATTR_EXP_KBS: "K",
    SSPLUS_ATTR_EXP_MBS: "M",
    SSPLUS_ATTR_EXP_GBS: "G",
    }
  format("id=%u speed=%u%sbs %s %s SuperSpeed%s",
                ssid,
                mantissa,
                exponents[exponent],
                type == :SSPLUS_ATTR_TYPE_ASYM ? "Asym" : "Sym",
                direction == :SSPLUS_ATTR_DIR_TX ? "TX" : "RX",
                protocol == :SSPLUS_ATTR_PROT_SSPLUS ? "+": "" )
end

#typeObject

This field identifies whether the Sublink Speed Attribute defines a symmetric or asymmetric bit rate.



220
221
222
# File 'lib/libusb/bos.rb', line 220

def type
  self[:type]
end