smart_card_connector_app/src/window-devices-displaying.js
/**
 * Filters out entries that correspond to spurious failures, based on heuristic.
 *
 * This is needed because for composite devices (e.g., a smart card reader and a
 * keyboard) the CCID driver attempts to initialize all interfaces, and all
 * non-smart-card-related interfaces fail. This function heuristically hides
 * some of the errors, in order to minimize the user confusion.
 * @param {!Array<!GSC.PcscLiteServer.ReaderInfo>} readers
 * @return {!Array<!GSC.PcscLiteServer.ReaderInfo>}
 */
Filters out entries that correspond to spurious failures, based on heuristic.
This is needed because for composite devices  the CCID driver attempts to initialize all interfaces, and all
non-smart-card-related interfaces fail. This function heuristically hides
some of the errors, in order to minimize the user confusion.
@param {!Array} readers
@return {!Array}
Filters out entries that correspond to spurious failures based on heuristic . This is needed because for composite devices the CCID driver attempts to initialize all interfaces and all non - smart - card - related interfaces fail . This function heuristically hides some of the errors in order to minimize the user confusion . @param { !Array } readers @return { !Array }
function removeSpuriousFailures(readers) {
  const nonFailedReaders = readers.filter(
      reader => reader['status'] != GSC.PcscLiteServer.ReaderStatus.FAILURE);
  const nonFailedDisplayNames = new Set(nonFailedReaders.map(
      reader => makeReaderNameForDisplaying(reader['name'])));
  const filteredReaders = readers.filter(reader => {
    if (reader['status'] !== GSC.PcscLiteServer.ReaderStatus.FAILURE)
      return true;
    if (nonFailedDisplayNames.has(
            makeReaderNameForDisplaying(reader['name']))) {
      goog.log.info(
          logger, `Hiding spuriously failed reader ${reader['name']}`);
      return false;
    }
    return true;
  });
  return filteredReaders;
}
function removeSpuriousFailures ( readers ) { const nonFailedReaders = readers . filter ( reader => reader [ 'status' ] != GSC . PcscLiteServer . ReaderStatus . FAILURE ) ; const nonFailedDisplayNames = new Set ( nonFailedReaders . map ( reader => makeReaderNameForDisplaying ( reader [ 'name' ] ) ) ) ; const filteredReaders = readers . filter ( reader => { if ( reader [ 'status' ] !== GSC . PcscLiteServer . ReaderStatus . FAILURE ) return true ; if ( nonFailedDisplayNames . has ( makeReaderNameForDisplaying ( reader [ 'name' ] ) ) ) { goog . log . info ( logger , ` ${ reader [ 'name' ] } ` ) ; return false ; } return true ; } ) ; return filteredReaders ; }
Filters out entries that correspond to spurious failures, based on heuristic.
Filters out entries that correspond to spurious failures based on heuristic .
// The heuristic is to hide such failure entries that evaluate to the same // display name as a reader that got initialized successfully. /** @type {!Array<!GSC.PcscLiteServer.ReaderInfo>} */ /** @type {!Set<string>} */ /** @type {!Array<!GSC.PcscLiteServer.ReaderInfo>} */