third_party/libusb/webport/src/libusb-to-webusb-adaptor.js
/**
 * @param {!Object} webusbDevice The WebUSB USBDevice object.
 * @param {!Object} setup The WebUSB USBControlTransferParameters value.
 * @param {!ArrayBuffer} data
 * @return {!Promise<!Object>} The WebUSB USBOutTransferResult value.
 */
@param {!Object} webusbDevice The WebUSB USBDevice object.
@param {!Object} setup The WebUSB USBControlTransferParameters value.
@param { !Object } webusbDevice The WebUSB USBDevice object . @param { !Object } setup The WebUSB USBControlTransferParameters value .
async function callWebusbDeviceControlTransferOut(webusbDevice, setup, data) {
  const transferLogNumber = transferLogCounter;
  ++transferLogCounter;
  const functionLogTitle =
      `${dumpWebusbDeviceForLog(webusbDevice)}.controlTransferOut#${
          transferLogNumber}`;
  goog.log.info(
      logger,
      `${functionLogTitle}(${dump(setup)}, ${debugDump(data)}): called`);
  try {
    const transferResult =
        await webusbDevice['controlTransferOut'](setup, data);
    goog.log.info(
        logger,
        `${functionLogTitle}(): returned ${
            dumpWebusbOutTransferResultForLog(transferResult)}`);
    return transferResult;
  } catch (exc) {
    goog.log.info(logger, `${functionLogTitle}(): failed: ${exc}`);
    throw exc;
  }
}
async function callWebusbDeviceControlTransferOut ( webusbDevice , setup , data ) { const transferLogNumber = transferLogCounter ; ++ transferLogCounter ; const functionLogTitle = ` ${ dumpWebusbDeviceForLog ( webusbDevice ) } ${ transferLogNumber } ` ; goog . log . info ( logger , ` ${ functionLogTitle } ${ dump ( setup ) } ${ debugDump ( data ) } ` ) ; try { const transferResult = await webusbDevice [ 'controlTransferOut' ] ( setup , data ) ; goog . log . info ( logger , ` ${ functionLogTitle } ${ dumpWebusbOutTransferResultForLog ( transferResult ) } ` ) ; return transferResult ; } catch ( exc ) { goog . log . info ( logger , ` ${ functionLogTitle } ${ exc } ` ) ; throw exc ; } }
@param {!Object} webusbDevice The WebUSB USBDevice object.
@param { !Object } webusbDevice The WebUSB USBDevice object .
// Pass the data through `debugDump()`, so that this potentially // security/privacy sensitive information isn't logged in Release mode.