| Index: chrome/browser/resources/cryptotoken/usbgnubbydevice.js
|
| diff --git a/chrome/browser/resources/cryptotoken/usbgnubbydevice.js b/chrome/browser/resources/cryptotoken/usbgnubbydevice.js
|
| index 089ca1543ba3c67fbf643d82f4417459f5dd59d0..5ee13caa8926b2602271cde8707f0ce5265fd8f8 100644
|
| --- a/chrome/browser/resources/cryptotoken/usbgnubbydevice.js
|
| +++ b/chrome/browser/resources/cryptotoken/usbgnubbydevice.js
|
| @@ -77,8 +77,20 @@ UsbGnubbyDevice.prototype.destroy = function() {
|
| this.dev = null;
|
|
|
| chrome.usb.releaseInterface(dev, 0, function() {
|
| + if (chrome.runtime.lastError) {
|
| + console.warn(UTIL_fmt('Device ' + dev.handle +
|
| + ' couldn\'t be released:'));
|
| + console.warn(chrome.runtime.lastError);
|
| + return;
|
| + }
|
| console.log(UTIL_fmt('Device ' + dev.handle + ' released'));
|
| chrome.usb.closeDevice(dev, function() {
|
| + if (chrome.runtime.lastError) {
|
| + console.warn(UTIL_fmt('Device ' + dev.handle +
|
| + ' couldn\'t be closed:'));
|
| + console.warn(chrome.runtime.lastError);
|
| + return;
|
| + }
|
| console.log(UTIL_fmt('Device ' + dev.handle + ' closed'));
|
| });
|
| });
|
| @@ -276,8 +288,9 @@ UsbGnubbyDevice.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,
|
| @@ -292,8 +305,9 @@ UsbGnubbyDevice.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 get to go to the device to flush OS tx/rx queues.
|
| + // The usb firmware is to always respond to SYNC|INIT,
|
| + // regardless of lock status.
|
| }
|
| }
|
| return true;
|
| @@ -439,7 +453,7 @@ var InterfaceDescriptor;
|
| UsbGnubbyDevice.open = function(gnubbies, which, dev, cb) {
|
| /** @param {chrome.usb.ConnectionHandle=} handle Connection handle */
|
| function deviceOpened(handle) {
|
| - if (!handle) {
|
| + if (chrome.runtime.lastError) {
|
| console.warn(UTIL_fmt('failed to open device. permissions issue?'));
|
| cb(-GnubbyDevice.NODEVICE);
|
| return;
|
|
|