Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5670)

Unified Diff: chrome/browser/resources/cryptotoken/hidgnubbydevice.js

Issue 596083002: Update cryptotoken to 0.8.63 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove a deprecated line Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/cryptotoken/hidgnubbydevice.js
diff --git a/chrome/browser/resources/cryptotoken/hidgnubbydevice.js b/chrome/browser/resources/cryptotoken/hidgnubbydevice.js
index 850572e92cedcf357ff3777d39b703160957f33e..c7911054fb0bc58a1e1fdfc7a2eb9df7e0f08772 100644
--- a/chrome/browser/resources/cryptotoken/hidgnubbydevice.js
+++ b/chrome/browser/resources/cryptotoken/hidgnubbydevice.js
@@ -71,6 +71,12 @@ HidGnubbyDevice.prototype.destroy = function() {
this.dev = null;
chrome.hid.disconnect(dev.connectionId, function() {
+ if (chrome.runtime.lastError) {
+ console.warn(UTIL_fmt('Device ' + dev.connectionId +
+ ' couldn\'t be disconnected:'));
+ console.warn(chrome.runtime.lastError);
+ return;
+ }
console.log(UTIL_fmt('Device ' + dev.connectionId + ' closed'));
});
};
@@ -213,8 +219,9 @@ HidGnubbyDevice.prototype.checkLock_ = function(cid, cmd) {
if (this.lockCID != cid) {
// Some other channel has active lock.
- if (cmd != GnubbyDevice.CMD_SYNC) {
- // Anything but SYNC gets an immediate busy.
+ if (cmd != GnubbyDevice.CMD_SYNC &&
+ cmd != GnubbyDevice.CMD_INIT) {
+ // Anything but SYNC|INIT gets an immediate busy.
var busy = new Uint8Array(
[(cid >> 24) & 255,
(cid >> 16) & 255,
@@ -229,8 +236,9 @@ HidGnubbyDevice.prototype.checkLock_ = function(cid, cmd) {
return false;
}
- // SYNC gets to go to the device to flush OS tx/rx queues.
- // The usb firmware always responds to SYNC, regardless of lock status.
+ // SYNC|INIT gets to go to the device to flush OS tx/rx queues.
+ // The usb firmware is to alway respond to SYNC/INIT,
+ // regardless of lock status.
}
}
return true;
@@ -411,12 +419,18 @@ HidGnubbyDevice.enumerate = function(cb) {
}
}
- GnubbyDevice.getPermittedUsbDevices(function(devs) {
- permittedDevs = devs;
- for (var i = 0; i < devs.length; i++) {
- chrome.hid.getDevices(devs[i], enumerated);
- }
- });
+ try {
+ chrome.hid.getDevices({filters: [{usagePage: 0xf1d0}]}, cb);
+ } catch (e) {
+ console.log(e);
+ console.log(UTIL_fmt('falling back to vid/pid enumeration'));
+ GnubbyDevice.getPermittedUsbDevices(function(devs) {
+ permittedDevs = devs;
+ for (var i = 0; i < devs.length; i++) {
+ chrome.hid.getDevices(devs[i], enumerated);
+ }
+ });
+ }
};
/**

Powered by Google App Engine
This is Rietveld 408576698