Class: USB::DevHandle

Inherits:
Object
  • Object
show all
Defined in:
lib/usb.rb

Instance Method Summary collapse

Instance Method Details

#claim_interface(interface) ⇒ Object



399
400
401
402
# File 'lib/usb.rb', line 399

def claim_interface(interface)
  interface = interface.bInterfaceNumber if interface.respond_to? :bInterfaceNumber
  self.usb_claim_interface(interface)
end

#clear_halt(ep) ⇒ Object



394
395
396
397
# File 'lib/usb.rb', line 394

def clear_halt(ep)
  ep = ep.bEndpointAddress if ep.respond_to? :bEndpointAddress
  self.usb_clear_halt(ep)
end

#get_string_simple(index) ⇒ Object



409
410
411
412
413
414
415
416
417
418
# File 'lib/usb.rb', line 409

def get_string_simple(index)
  result = "\0" * 1024
  begin
    self.usb_get_string_simple(index, result)
  rescue Errno::EPIPE, Errno::EFBIG, Errno::EPERM, Errno::ERANGE
    return nil
  end
  result.delete!("\0")
  result
end

#release_interface(interface) ⇒ Object



404
405
406
407
# File 'lib/usb.rb', line 404

def release_interface(interface)
  interface = interface.bInterfaceNumber if interface.respond_to? :bInterfaceNumber
  self.usb_release_interface(interface)
end

#set_altinterface(alternate) ⇒ Object



389
390
391
392
# File 'lib/usb.rb', line 389

def set_altinterface(alternate)
  alternate = alternate.bAlternateSetting if alternate.respond_to? :bAlternateSetting
  self.usb_set_altinterface(alternate)
end

#set_configuration(configuration) ⇒ Object



384
385
386
387
# File 'lib/usb.rb', line 384

def set_configuration(configuration)
  configuration = configuration.bConfigurationValue if configuration.respond_to? :bConfigurationValue
  self.usb_set_configuration(configuration)
end