third_party/libusb/webport/src/libusb-to-webusb-adaptor.js
/**
   * Fills the extraData fields of all passed configurations by fetching and
   * parsing USB descriptors from the device.
   * @param {number} deviceId
   * @param {!Object} webusbDevice The WebUSB USBDevice object.
   * @param {!Array<!LibusbJsConfigurationDescriptor>} libusbJsConfigurations
   * @return {!Promise<void>}
   */
Fills the extraData fields of all passed configurations by fetching and
parsing USB descriptors from the device.
@param {number} deviceId
@param {!Object} webusbDevice The WebUSB USBDevice object.
@param {!Array} libusbJsConfigurations
@return {!Promise}
Fills the extraData fields of all passed configurations by fetching and parsing USB descriptors from the device . @param { number } deviceId @param { !Object } webusbDevice The WebUSB USBDevice object . @param { !Array } libusbJsConfigurations @return { !Promise }
async fetchAndFillConfigurationsExtraData_(
      deviceId, webusbDevice, libusbJsConfigurations) {
    let deviceHandle = null;
    try {
      deviceHandle = await this.openDeviceHandle(deviceId);
      for (const libusbJsConfiguration of libusbJsConfigurations) {
        await fetchAndFillConfigurationExtraDataForOpenedDevice(
            webusbDevice, libusbJsConfiguration);
      }
    } catch (exc) {
      goog.log.fine(logger, `Failure fetching extra data: ${exc}`);
    } finally {
      if (deviceHandle)
        this.closeDeviceHandle(deviceId, deviceHandle);
    }
  }
async fetchAndFillConfigurationsExtraData_ ( deviceId , webusbDevice , libusbJsConfigurations ) { let deviceHandle = null ; try { deviceHandle = await this . openDeviceHandle ( deviceId ) ; for ( const libusbJsConfiguration of libusbJsConfigurations ) { await fetchAndFillConfigurationExtraDataForOpenedDevice ( webusbDevice , libusbJsConfiguration ) ; } } catch ( exc ) { goog . log . fine ( logger , ` ${ exc } ` ) ; } finally { if ( deviceHandle ) this . closeDeviceHandle ( deviceId , deviceHandle ) ; } }
Fills the extraData fields of all passed configurations by fetching and
 parsing USB descriptors from the device.
Fills the extraData fields of all passed configurations by fetching and parsing USB descriptors from the device .
/** @preserveTry */ // The device needs to be opened throughout the fetching process, and // there might be concurrent open()/close() requests, so obtain and keep a // device handle in order to easily account for all that. // Suppress errors of fetching extraData: they should be non-fatal. // Log only at the "fine" level, as this can quickly flood the logs. // Release the handle, so that the device doesn't stay opened unless // there's another concurrent usage of it. We don't need to wait for this // operation to finish.