class USB::Device
Public Instance Methods
bDescriptorType()
click to toggle source
USB::Device#descriptor_bDescriptorType
static VALUE rusb_devdesc_bDescriptorType(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDescriptorType); } /* USB::Device#descriptor_bcdUSB */ static VALUE rusb_devdesc_bcdUSB(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdUSB); } /* USB::Device#descriptor_bDeviceClass */ static VALUE rusb_devdesc_bDeviceClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceClass); } /* USB::Device#descriptor_bDeviceSubClass */ static VALUE rusb_devdesc_bDeviceSubClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceSubClass); } /* USB::Device#descriptor_bDeviceProtocol */ static VALUE rusb_devdesc_bDeviceProtocol(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceProtocol); } /* USB::Device#descriptor_bMaxPacketSize0 */ static VALUE rusb_devdesc_bMaxPacketSize0(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bMaxPacketSize0); } /* USB::Device#descriptor_idVendor */ static VALUE rusb_devdesc_idVendor(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idVendor); } /* USB::Device#descriptor_idProduct */ static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bDeviceClass()
click to toggle source
USB::Device#descriptor_bDeviceClass
static VALUE rusb_devdesc_bDeviceClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceClass); } /* USB::Device#descriptor_bDeviceSubClass */ static VALUE rusb_devdesc_bDeviceSubClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceSubClass); } /* USB::Device#descriptor_bDeviceProtocol */ static VALUE rusb_devdesc_bDeviceProtocol(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceProtocol); } /* USB::Device#descriptor_bMaxPacketSize0 */ static VALUE rusb_devdesc_bMaxPacketSize0(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bMaxPacketSize0); } /* USB::Device#descriptor_idVendor */ static VALUE rusb_devdesc_idVendor(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idVendor); } /* USB::Device#descriptor_idProduct */ static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bDeviceProtocol()
click to toggle source
USB::Device#descriptor_bDeviceProtocol
static VALUE rusb_devdesc_bDeviceProtocol(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceProtocol); } /* USB::Device#descriptor_bMaxPacketSize0 */ static VALUE rusb_devdesc_bMaxPacketSize0(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bMaxPacketSize0); } /* USB::Device#descriptor_idVendor */ static VALUE rusb_devdesc_idVendor(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idVendor); } /* USB::Device#descriptor_idProduct */ static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bDeviceSubClass()
click to toggle source
USB::Device#descriptor_bDeviceSubClass
static VALUE rusb_devdesc_bDeviceSubClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceSubClass); } /* USB::Device#descriptor_bDeviceProtocol */ static VALUE rusb_devdesc_bDeviceProtocol(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceProtocol); } /* USB::Device#descriptor_bMaxPacketSize0 */ static VALUE rusb_devdesc_bMaxPacketSize0(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bMaxPacketSize0); } /* USB::Device#descriptor_idVendor */ static VALUE rusb_devdesc_idVendor(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idVendor); } /* USB::Device#descriptor_idProduct */ static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bLength()
click to toggle source
USB::Device#descriptor_bLength
static VALUE rusb_devdesc_bLength(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bLength); } /* USB::Device#descriptor_bDescriptorType */ static VALUE rusb_devdesc_bDescriptorType(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDescriptorType); } /* USB::Device#descriptor_bcdUSB */ static VALUE rusb_devdesc_bcdUSB(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdUSB); } /* USB::Device#descriptor_bDeviceClass */ static VALUE rusb_devdesc_bDeviceClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceClass); } /* USB::Device#descriptor_bDeviceSubClass */ static VALUE rusb_devdesc_bDeviceSubClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceSubClass); } /* USB::Device#descriptor_bDeviceProtocol */ static VALUE rusb_devdesc_bDeviceProtocol(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceProtocol); } /* USB::Device#descriptor_bMaxPacketSize0 */ static VALUE rusb_devdesc_bMaxPacketSize0(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bMaxPacketSize0); } /* USB::Device#descriptor_idVendor */ static VALUE rusb_devdesc_idVendor(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idVendor); } /* USB::Device#descriptor_idProduct */ static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bMaxPacketSize0()
click to toggle source
USB::Device#descriptor_bMaxPacketSize0
static VALUE rusb_devdesc_bMaxPacketSize0(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bMaxPacketSize0); } /* USB::Device#descriptor_idVendor */ static VALUE rusb_devdesc_idVendor(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idVendor); } /* USB::Device#descriptor_idProduct */ static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bNumConfigurations()
click to toggle source
USB::Device#descriptor_bNumConfigurations
static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bcdDevice()
click to toggle source
USB::Device#descriptor_bcdDevice
static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bcdUSB()
click to toggle source
USB::Device#descriptor_bcdUSB
static VALUE rusb_devdesc_bcdUSB(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdUSB); } /* USB::Device#descriptor_bDeviceClass */ static VALUE rusb_devdesc_bDeviceClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceClass); } /* USB::Device#descriptor_bDeviceSubClass */ static VALUE rusb_devdesc_bDeviceSubClass(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceSubClass); } /* USB::Device#descriptor_bDeviceProtocol */ static VALUE rusb_devdesc_bDeviceProtocol(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bDeviceProtocol); } /* USB::Device#descriptor_bMaxPacketSize0 */ static VALUE rusb_devdesc_bMaxPacketSize0(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bMaxPacketSize0); } /* USB::Device#descriptor_idVendor */ static VALUE rusb_devdesc_idVendor(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idVendor); } /* USB::Device#descriptor_idProduct */ static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
bus()
click to toggle source
static VALUE rusb_device_bus(VALUE v) { return rusb_bus_make(get_usb_device(v)->bus, Qnil); } /* USB::Device#devnum */ static VALUE rusb_device_devnum(VALUE v) { return INT2FIX(get_usb_device(v)->devnum); } /* USB::Device#num_children */ static VALUE rusb_device_num_children(VALUE v) { return INT2FIX(get_usb_device(v)->num_children); } /* USB::Device#children */ static VALUE rusb_device_children(VALUE vdevice) { rusb_device_t *d = get_rusb_device(vdevice); struct usb_device *device = d->ptr; int i; VALUE children = rb_ary_new2(device->num_children); for (i = 0; i < device->num_children; i++) rb_ary_store(children, i, rusb_device_make(device->children[i], d->parent)); return children; }
children()
click to toggle source
static VALUE rusb_device_children(VALUE vdevice) { rusb_device_t *d = get_rusb_device(vdevice); struct usb_device *device = d->ptr; int i; VALUE children = rb_ary_new2(device->num_children); for (i = 0; i < device->num_children; i++) rb_ary_store(children, i, rusb_device_make(device->children[i], d->parent)); return children; }
configurations()
click to toggle source
static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
devnum()
click to toggle source
static VALUE rusb_device_devnum(VALUE v) { return INT2FIX(get_usb_device(v)->devnum); } /* USB::Device#num_children */ static VALUE rusb_device_num_children(VALUE v) { return INT2FIX(get_usb_device(v)->num_children); } /* USB::Device#children */ static VALUE rusb_device_children(VALUE vdevice) { rusb_device_t *d = get_rusb_device(vdevice); struct usb_device *device = d->ptr; int i; VALUE children = rb_ary_new2(device->num_children); for (i = 0; i < device->num_children; i++) rb_ary_store(children, i, rusb_device_make(device->children[i], d->parent)); return children; }
endpoints()
click to toggle source
# File lib/usb.rb, line 287 def endpoints() self.settings.map {|d| d.endpoints }.flatten end
filename()
click to toggle source
static VALUE rusb_device_filename(VALUE v) { return rb_str_new2(get_usb_device(v)->filename); } /* USB::Device#bus */ static VALUE rusb_device_bus(VALUE v) { return rusb_bus_make(get_usb_device(v)->bus, Qnil); } /* USB::Device#devnum */ static VALUE rusb_device_devnum(VALUE v) { return INT2FIX(get_usb_device(v)->devnum); } /* USB::Device#num_children */ static VALUE rusb_device_num_children(VALUE v) { return INT2FIX(get_usb_device(v)->num_children); } /* USB::Device#children */ static VALUE rusb_device_children(VALUE vdevice) { rusb_device_t *d = get_rusb_device(vdevice); struct usb_device *device = d->ptr; int i; VALUE children = rb_ary_new2(device->num_children); for (i = 0; i < device->num_children; i++) rb_ary_store(children, i, rusb_device_make(device->children[i], d->parent)); return children; }
iManufacturer()
click to toggle source
USB::Device#descriptor_iManufacturer
static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
iProduct()
click to toggle source
USB::Device#descriptor_iProduct
static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
iSerialNumber()
click to toggle source
USB::Device#descriptor_iSerialNumber
static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
idProduct()
click to toggle source
USB::Device#descriptor_idProduct
static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
idVendor()
click to toggle source
USB::Device#descriptor_idVendor
static VALUE rusb_devdesc_idVendor(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idVendor); } /* USB::Device#descriptor_idProduct */ static VALUE rusb_devdesc_idProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.idProduct); } /* USB::Device#descriptor_bcdDevice */ static VALUE rusb_devdesc_bcdDevice(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bcdDevice); } /* USB::Device#descriptor_iManufacturer */ static VALUE rusb_devdesc_iManufacturer(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iManufacturer); } /* USB::Device#descriptor_iProduct */ static VALUE rusb_devdesc_iProduct(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iProduct); } /* USB::Device#descriptor_iSerialNumber */ static VALUE rusb_devdesc_iSerialNumber(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.iSerialNumber); } /* USB::Device#descriptor_bNumConfigurations */ static VALUE rusb_devdesc_bNumConfigurations(VALUE v) { return INT2FIX(get_usb_device(v)->descriptor.bNumConfigurations); } /* USB::Device#configurations */ static VALUE rusb_device_config(VALUE v) { struct usb_device *device = get_usb_device(v); int i; VALUE children = rb_ary_new2(device->descriptor.bNumConfigurations); for (i = 0; i < device->descriptor.bNumConfigurations; i++) rb_ary_store(children, i, rusb_config_descriptor_make(&device->config[i], v)); return children; }
inspect()
click to toggle source
# File lib/usb.rb, line 228 def inspect if self.revoked? "\#<#{self.class} revoked>" else attrs = [] attrs << "#{self.bus.dirname}/#{self.filename}" attrs << ("%04x:%04x" % [self.idVendor, self.idProduct]) attrs << self.manufacturer attrs << self.product attrs << self.serial_number if self.bDeviceClass == USB::USB_CLASS_PER_INTERFACE devclass = self.settings.map {|i| USB.dev_string(i.bInterfaceClass, i.bInterfaceSubClass, i.bInterfaceProtocol) }.join(", ") else devclass = USB.dev_string(self.bDeviceClass, self.bDeviceSubClass, self.bDeviceProtocol) end attrs << "(#{devclass})" attrs.compact! "\#<#{self.class} #{attrs.join(' ')}>" end end
interfaces()
click to toggle source
# File lib/usb.rb, line 285 def interfaces() self.configurations.map {|d| d.interfaces }.flatten end
manufacturer()
click to toggle source
# File lib/usb.rb, line 251 def manufacturer return @manufacturer if defined? @manufacturer @manufacturer = self.open {|h| h.get_string_simple(self.iManufacturer) } @manufacturer.strip! if @manufacturer @manufacturer end
next()
click to toggle source
static VALUE rusb_device_next(VALUE v) { rusb_device_t *device = get_rusb_device(v); return rusb_device_make(device->ptr->next, device->parent); } /* USB::Device#filename */ static VALUE rusb_device_filename(VALUE v) { return rb_str_new2(get_usb_device(v)->filename); } /* USB::Device#bus */ static VALUE rusb_device_bus(VALUE v) { return rusb_bus_make(get_usb_device(v)->bus, Qnil); } /* USB::Device#devnum */ static VALUE rusb_device_devnum(VALUE v) { return INT2FIX(get_usb_device(v)->devnum); } /* USB::Device#num_children */ static VALUE rusb_device_num_children(VALUE v) { return INT2FIX(get_usb_device(v)->num_children); } /* USB::Device#children */ static VALUE rusb_device_children(VALUE vdevice) { rusb_device_t *d = get_rusb_device(vdevice); struct usb_device *device = d->ptr; int i; VALUE children = rb_ary_new2(device->num_children); for (i = 0; i < device->num_children; i++) rb_ary_store(children, i, rusb_device_make(device->children[i], d->parent)); return children; }
num_children()
click to toggle source
static VALUE rusb_device_num_children(VALUE v) { return INT2FIX(get_usb_device(v)->num_children); } /* USB::Device#children */ static VALUE rusb_device_children(VALUE vdevice) { rusb_device_t *d = get_rusb_device(vdevice); struct usb_device *device = d->ptr; int i; VALUE children = rb_ary_new2(device->num_children); for (i = 0; i < device->num_children; i++) rb_ary_store(children, i, rusb_device_make(device->children[i], d->parent)); return children; }
open() { |h| ... }
click to toggle source
# File lib/usb.rb, line 272 def open h = self.usb_open if block_given? begin r = yield h ensure h.usb_close end else h end end
prev()
click to toggle source
static VALUE rusb_device_prev(VALUE v) { rusb_device_t *device = get_rusb_device(v); return rusb_device_make(device->ptr->prev, device->parent); } /* USB::Device#next */ static VALUE rusb_device_next(VALUE v) { rusb_device_t *device = get_rusb_device(v); return rusb_device_make(device->ptr->next, device->parent); } /* USB::Device#filename */ static VALUE rusb_device_filename(VALUE v) { return rb_str_new2(get_usb_device(v)->filename); } /* USB::Device#bus */ static VALUE rusb_device_bus(VALUE v) { return rusb_bus_make(get_usb_device(v)->bus, Qnil); } /* USB::Device#devnum */ static VALUE rusb_device_devnum(VALUE v) { return INT2FIX(get_usb_device(v)->devnum); } /* USB::Device#num_children */ static VALUE rusb_device_num_children(VALUE v) { return INT2FIX(get_usb_device(v)->num_children); } /* USB::Device#children */ static VALUE rusb_device_children(VALUE vdevice) { rusb_device_t *d = get_rusb_device(vdevice); struct usb_device *device = d->ptr; int i; VALUE children = rb_ary_new2(device->num_children); for (i = 0; i < device->num_children; i++) rb_ary_store(children, i, rusb_device_make(device->children[i], d->parent)); return children; }
product()
click to toggle source
# File lib/usb.rb, line 258 def product return @product if defined? @product @product = self.open {|h| h.get_string_simple(self.iProduct) } @product.strip! if @product @product end
revoked?()
click to toggle source
static VALUE rusb_device_revoked_p(VALUE v) { return RTEST(!check_usb_device(v)); }
serial_number()
click to toggle source
# File lib/usb.rb, line 265 def serial_number return @serial_number if defined? @serial_number @serial_number = self.open {|h| h.get_string_simple(self.iSerialNumber) } @serial_number.strip! if @serial_number @serial_number end
settings()
click to toggle source
# File lib/usb.rb, line 286 def settings() self.interfaces.map {|d| d.settings }.flatten end
usb_open()
click to toggle source
static VALUE rusb_device_open(VALUE vdevice) { struct usb_device *device = get_usb_device(vdevice); usb_dev_handle *h = usb_open(device); return rusb_dev_handle_new(h); }