class USB::Endpoint

Public Instance Methods

bDescriptorType() click to toggle source

#bDescriptorType

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

/* USB::Endpoint#bEndpointAddress */
static VALUE rusb_endpoint_bEndpointAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bEndpointAddress); }

/* USB::Endpoint#bmAttributes */
static VALUE rusb_endpoint_bmAttributes(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bmAttributes); }

/* USB::Endpoint#wMaxPacketSize */
static VALUE rusb_endpoint_wMaxPacketSize(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->wMaxPacketSize); }

/* USB::Endpoint#bInterval */
static VALUE rusb_endpoint_bInterval(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bInterval); }

/* USB::Endpoint#bRefresh */
static VALUE rusb_endpoint_bRefresh(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bRefresh); }

/* USB::Endpoint#bSynchAddress */
static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}
bEndpointAddress() click to toggle source

#bEndpointAddress

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

/* USB::Endpoint#bmAttributes */
static VALUE rusb_endpoint_bmAttributes(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bmAttributes); }

/* USB::Endpoint#wMaxPacketSize */
static VALUE rusb_endpoint_wMaxPacketSize(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->wMaxPacketSize); }

/* USB::Endpoint#bInterval */
static VALUE rusb_endpoint_bInterval(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bInterval); }

/* USB::Endpoint#bRefresh */
static VALUE rusb_endpoint_bRefresh(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bRefresh); }

/* USB::Endpoint#bSynchAddress */
static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}
bInterval() click to toggle source

#bInterval

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

/* USB::Endpoint#bRefresh */
static VALUE rusb_endpoint_bRefresh(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bRefresh); }

/* USB::Endpoint#bSynchAddress */
static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}
bLength() click to toggle source

#bLength

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

/* USB::Endpoint#bDescriptorType */
static VALUE rusb_endpoint_bDescriptorType(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bDescriptorType); }

/* USB::Endpoint#bEndpointAddress */
static VALUE rusb_endpoint_bEndpointAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bEndpointAddress); }

/* USB::Endpoint#bmAttributes */
static VALUE rusb_endpoint_bmAttributes(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bmAttributes); }

/* USB::Endpoint#wMaxPacketSize */
static VALUE rusb_endpoint_wMaxPacketSize(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->wMaxPacketSize); }

/* USB::Endpoint#bInterval */
static VALUE rusb_endpoint_bInterval(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bInterval); }

/* USB::Endpoint#bRefresh */
static VALUE rusb_endpoint_bRefresh(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bRefresh); }

/* USB::Endpoint#bSynchAddress */
static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}
bRefresh() click to toggle source

#bRefresh

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

/* USB::Endpoint#bSynchAddress */
static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}
bSynchAddress() click to toggle source

#bSynchAddress

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

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}
bmAttributes() click to toggle source

#bmAttributes

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

/* USB::Endpoint#wMaxPacketSize */
static VALUE rusb_endpoint_wMaxPacketSize(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->wMaxPacketSize); }

/* USB::Endpoint#bInterval */
static VALUE rusb_endpoint_bInterval(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bInterval); }

/* USB::Endpoint#bRefresh */
static VALUE rusb_endpoint_bRefresh(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bRefresh); }

/* USB::Endpoint#bSynchAddress */
static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}
bus() click to toggle source
# File lib/usb.rb, line 377
def bus() self.setting.interface.configuration.device.bus end
configuration() click to toggle source
# File lib/usb.rb, line 379
def configuration() self.setting.interface.configuration end
device() click to toggle source
# File lib/usb.rb, line 378
def device() self.setting.interface.configuration.device end
inspect() click to toggle source
# 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
interface() click to toggle source
# File lib/usb.rb, line 380
def interface() self.setting.interface end
revoked?() click to toggle source

#revoked?

static VALUE
rusb_endpoint_revoked_p(VALUE v)
{
  return RTEST(!check_usb_endpoint_descriptor(v));
}
setting() click to toggle source

#setting

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

/* USB::Endpoint#bLength */
static VALUE rusb_endpoint_bLength(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bLength); }

/* USB::Endpoint#bDescriptorType */
static VALUE rusb_endpoint_bDescriptorType(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bDescriptorType); }

/* USB::Endpoint#bEndpointAddress */
static VALUE rusb_endpoint_bEndpointAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bEndpointAddress); }

/* USB::Endpoint#bmAttributes */
static VALUE rusb_endpoint_bmAttributes(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bmAttributes); }

/* USB::Endpoint#wMaxPacketSize */
static VALUE rusb_endpoint_wMaxPacketSize(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->wMaxPacketSize); }

/* USB::Endpoint#bInterval */
static VALUE rusb_endpoint_bInterval(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bInterval); }

/* USB::Endpoint#bRefresh */
static VALUE rusb_endpoint_bRefresh(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bRefresh); }

/* USB::Endpoint#bSynchAddress */
static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}
wMaxPacketSize() click to toggle source

#wMaxPacketSize

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

/* USB::Endpoint#bInterval */
static VALUE rusb_endpoint_bInterval(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bInterval); }

/* USB::Endpoint#bRefresh */
static VALUE rusb_endpoint_bRefresh(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bRefresh); }

/* USB::Endpoint#bSynchAddress */
static VALUE rusb_endpoint_bSynchAddress(VALUE v) { return INT2FIX(get_usb_endpoint_descriptor(v)->bSynchAddress); }

/* -------- USB::DevHandle -------- */

static VALUE rb_cUSB_DevHandle;

void rusb_devhandle_free(void *_h)
{
  usb_dev_handle *h = (usb_dev_handle *)_h;
  if (h) usb_close(h);
}