Class: USB::Endpoint

Inherits:
Data
  • Object
show all
Defined in:
lib/usb.rb,
ext/usb.c

Instance Method Summary collapse

Instance Method Details

#bDescriptorTypeObject

USB::Endpoint#bDescriptorType



408
# File 'ext/usb.c', line 408

static VALUE rusb_endpoint_bDescriptorType(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bDescriptorType); }

#bEndpointAddressObject

USB::Endpoint#bEndpointAddress



411
# File 'ext/usb.c', line 411

static VALUE rusb_endpoint_bEndpointAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bEndpointAddress); }

#bIntervalObject

USB::Endpoint#bInterval



420
# File 'ext/usb.c', line 420

static VALUE rusb_endpoint_bInterval(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bInterval); }

#bLengthObject

USB::Endpoint#bLength



405
# File 'ext/usb.c', line 405

static VALUE rusb_endpoint_bLength(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bLength); }

#bmAttributesObject

USB::Endpoint#bmAttributes



414
# File 'ext/usb.c', line 414

static VALUE rusb_endpoint_bmAttributes(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bmAttributes); }

#bRefreshObject

USB::Endpoint#bRefresh



423
# File 'ext/usb.c', line 423

static VALUE rusb_endpoint_bRefresh(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bRefresh); }

#bSynchAddressObject

USB::Endpoint#bSynchAddress



426
# File 'ext/usb.c', line 426

static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

#busObject



377
# File 'lib/usb.rb', line 377

def bus() self.setting.interface.configuration.device.bus end

#configurationObject



379
# File 'lib/usb.rb', line 379

def configuration() self.setting.interface.configuration end

#deviceObject



378
# File 'lib/usb.rb', line 378

def device() self.setting.interface.configuration.device end

#inspectObject



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/usb.rb', line 358

def inspect
  if self.revoked?
    "\#<#{self.class} revoked>"
  else
    endpoint_address = self.bEndpointAddress
    num = endpoint_address & 0b00001111
    inout = (endpoint_address & 0b10000000) == 0 ? "OUT" : "IN "
    bits = self.bmAttributes
    transfer_type = %w[Control Isochronous Bulk Interrupt][0b11 & bits]
    type = [transfer_type]
    if transfer_type == 'Isochronous'
      synchronization_type = %w[NoSynchronization Asynchronous Adaptive Synchronous][(0b1100 & bits) >> 2]
      usage_type = %w[Data Feedback ImplicitFeedback ?][(0b110000 & bits) >> 4]
      type << synchronization_type << usage_type
    end
    "\#<#{self.class} #{num} #{inout} #{type.join(" ")}>"
  end
end

#interfaceObject



380
# File 'lib/usb.rb', line 380

def interface() self.setting.interface end

#revoked?Boolean

USB::Endpoint#revoked?

Returns:

  • (Boolean)


395
396
397
398
399
# File 'ext/usb.c', line 395

static VALUE
rusb_endpoint_revoked_p(VALUE v)
{
  return RTEST(!check_usb_endpoint_descriptor(v));
}

#settingObject

USB::Endpoint#setting



402
# File 'ext/usb.c', line 402

static VALUE rusb_endpoint_setting(VALUE v) { return get_rusb_endpoint_descriptor(v)->parent; }

#wMaxPacketSizeObject

USB::Endpoint#wMaxPacketSize



417
# File 'ext/usb.c', line 417

static VALUE rusb_endpoint_wMaxPacketSize(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->wMaxPacketSize); }