Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
keeramis committed Aug 2, 2023
1 parent d6ab667 commit de786d1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 151 deletions.
26 changes: 0 additions & 26 deletions src/usb-device-webusb.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,32 +119,6 @@ class UsbDevice {
}
}

getInterfaceInfo() {

}

getDescriptorString(intrface) {
return new Promise((resolve) => {
try {
this._dev.getStringDescriptor(intrface, (err, intrfaceName) => {
if (err) {
try {
this._dev.close();
} catch (err) {
console.log(`Unable to close device: ${err.message}`);
// Ignore error
}
throw new Error('Unable to get serial number descriptor');
}
this._dev.particle.isOpen = true;
resolve(intrfaceName);
});
} catch (err) {
throw new Error('Failed to claim interface');
}
});
}

get vendorId() {
return this._dev.vendorId;
}
Expand Down
15 changes: 13 additions & 2 deletions test/dfu-device.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { fakeUsb, expect } = require('./support');
const proxyquire = require('proxyquire');
const sinon = require('sinon');
const { InternalFlashParsedP2 } = require('./support/usb-data');
const { DfuDeviceState, DfuseCommand } = require('../src/dfu');

const { getDevices } = proxyquire('../src/particle-usb', {
Expand Down Expand Up @@ -142,7 +141,19 @@ describe('dfu device', () => { // actually tests src/dfu.js which is the dfu dri
const p2Dev = devs[0];
await p2Dev.open();
expect(p2Dev.isOpen).to.be.true;
p2Dev._dfu._memoryInfo = InternalFlashParsedP2;
p2Dev._dfu._memoryInfo = {
'name': 'Internal Flash',
'segments': [
{
'start': 134217728,
'sectorSize': 4096,
'end': 142606336,
'readable': true,
'erasable': true,
'writable': true
}
]
};
const startAddr = 134610944;
const length = 1009100;
const dfuseCommandStub = sinon.stub(p2Dev._dfu, '_dfuseCommand');
Expand Down
9 changes: 0 additions & 9 deletions test/support/fake-usb.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,6 @@ class DfuClass {
};
}

_getInterfaces() {
return;
}

hostToDeviceRequest(setup, data) {
if (setup.bmRequestType !== dfu.DfuBmRequestType.HOST_TO_DEVICE) {
throw new UsbError('Unknown bmRequestType');
Expand Down Expand Up @@ -388,11 +384,6 @@ class DfuClass {

setAltSetting(/* iface, setting */) {
// Noop for now

// check if alt interface is <=2

// set the interfaces in the device descriptor to something

}

async _pollUntil(statePredicate) {
Expand Down
114 changes: 0 additions & 114 deletions test/support/usb-data.js

This file was deleted.

0 comments on commit de786d1

Please sign in to comment.