def set_configuration(configuration)
      configuration = configuration.bConfigurationValue if configuration.respond_to? :bConfigurationValue
      res = Call.libusb_set_configuration(@pHandle, configuration || -1)
      LIBUSB.raise_error res, "in libusb_set_configuration" if res!=0
    end
def set_configuration(configuration)
      configuration = configuration.bConfigurationValue if configuration.respond_to? :bConfigurationValue
      res = Call.libusb_set_configuration(@pHandle, configuration || -1)
      LIBUSB.raise_error res, "in libusb_set_configuration" if res!=0
    end
Set the active configuration for a device.

 The operating system may or may not have already set an active configuration on
 the device. It is up to your application to ensure the correct configuration is
 selected before you attempt to claim interfaces and perform other operations.

 If you call this function on a device already configured with the selected
 configuration, then this function will act as a lightweight device reset: it
 will issue a SET_CONFIGURATION request using the current configuration, causing
 most USB-related device state to be reset (altsetting reset to zero, endpoint
 halts cleared, toggles reset).

 You cannot change/reset configuration if your application has claimed interfaces -
 you should free them with {DevHandle#release_interface} first. You cannot
 change/reset configuration if other applications or drivers have claimed
 interfaces.

 A configuration value of +nil+ will put the device in unconfigured state. The USB
 specifications state that a configuration value of 0 does this, however buggy
 devices exist which actually have a configuration 0.

 You should always use this function rather than formulating your own
 SET_CONFIGURATION control request. This is because the underlying operating
 system needs to know when such changes happen.

 This is a blocking function.

 @param [Configuration, Fixnum] configuration   the configuration or it's
   bConfigurationValue you wish to activate, or +nil+ if you wish to put
   the device in unconfigured state