Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeuz committed Aug 2, 2023
1 parent 1ff6f0b commit 55acc19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/dfu.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Dfu {
await this._dev.claimInterface(this._interface);
this._claimed = true;
await this._dev.setAltSetting(this._interface, this._alternate);
let desc = await this._getConfigDescriptor(this._interface); // XXX: Changing the interface is not supported
let desc = await this._getConfigDescriptor(0); // Use the default config
desc = this._parseConfigDescriptor(desc);
this._allInterfaces = desc.interfaces;
}
Expand Down Expand Up @@ -204,7 +204,7 @@ class Dfu {
/**
* Set the alternate interface for DFU and initialize memory information.
*
* @param {number} ifaceIdx - The alternate interface index to set.
* @param {number} setting - The alternate interface index to set.
* @return {Promise}
*/
async setAltSetting(setting) {
Expand All @@ -223,7 +223,7 @@ class Dfu {
}
const ifaceName = await this._getStringDescriptor(iface.iInterface);
const memInfo = this._parseMemoryDescriptor(ifaceName);
await this._dev.setAltInterface(setting);
await this._dev.setAltSetting(this._interface, setting);
if (iface.dfuFunctional && iface.dfuFunctional.wTransferSize) {
this._transferSize = iface.dfuFunctional.wTransferSize;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/usb-device-webusb.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class UsbDevice {
index: setup.wIndex
}, setup.wLength);
if (res.status !== 'ok') {
throw new Error(res.status);
throw new Error(`Status: ${res.status}`);
}
return Buffer.from(res.data.buffer);
} catch (err) {
Expand All @@ -94,7 +94,7 @@ class UsbDevice {
index: setup.wIndex
}, data); // data is optional
if (res.status !== 'ok') {
throw new Error(res.status);
throw new Error(`Status: ${res.status}`);
}
} catch (err) {
throw new UsbError('OUT control transfer failed', { cause: err });
Expand Down

0 comments on commit 55acc19

Please sign in to comment.