Skip to content

Commit e167501

Browse files
committed
Remove OutEndpoint::startStream and related.
They don't work as they should, and no one uses them.
1 parent a1b960b commit e167501

File tree

3 files changed

+0
-76
lines changed

3 files changed

+0
-76
lines changed

Readme.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -242,26 +242,6 @@ If length is greater than maxPacketSize, libusb will automatically split the tra
242242

243243
`this` in the callback is the OutEndpoint object.
244244

245-
### .startStream(nTransfers=3, transferSize=maxPacketSize)
246-
Start a streaming transfer to the endpoint.
247-
248-
The library will help you maintain `nTransfers` transfers pending in the kernel to ensure continuous data flow.
249-
The `drain` event is emitted when another transfer is necessary. Your `drain` handler should use the .write() method
250-
to start another transfer.
251-
252-
### .write(data)
253-
Write `data` to the endpoint with the stream. `data` should be a buffer of length `transferSize` as passed to startStream.
254-
255-
Delegates to .transfer(), but differs in that it updates the stream state tracking the number of requests in flight.
256-
257-
### .stopStream()
258-
Stop the streaming transfer.
259-
260-
No further `drain` events will be emitted. When all transfers have been completed, the OutEndpoint emits the `end` event.
261-
262-
### Event: drain
263-
Emitted when the stream requests more data. Use the .write() method to start another transfer.
264-
265245
### Event: error(error)
266246
Emitted when the stream encounters an error.
267247

test/usb.coffee

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -178,26 +178,6 @@ describe 'Device', ->
178178
assert.ok(e == undefined, e)
179179
done()
180180

181-
it 'should be a writableStream', (done)->
182-
pkts = 0
183-
184-
outEndpoint.startStream 4, 64
185-
outEndpoint.on 'drain', ->
186-
pkts++
187-
188-
outEndpoint.write(new Buffer(64));
189-
190-
if pkts == 100
191-
outEndpoint.stopStream()
192-
#console.log("Stopping stream")
193-
194-
outEndpoint.on 'error', (e) ->
195-
#console.log("Stream error", e)
196-
197-
outEndpoint.on 'end', ->
198-
#console.log("Stream stopped")
199-
done()
200-
201181
after (cb) ->
202182
iface.release(cb)
203183

usb.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -349,39 +349,3 @@ OutEndpoint.prototype.transferWithZLP = function (buf, cb) {
349349
this.transfer(buf, cb);
350350
}
351351
}
352-
353-
354-
OutEndpoint.prototype.startStream = function startStream(n_transfers, transfer_size){
355-
n_transfers = n_transfers || 3;
356-
transfer_size = transfer_size || this.descriptor.wMaxPacketSize;
357-
this.streamActive = true;
358-
this._streamTransfers = n_transfers;
359-
this._pendingTransfers = 0;
360-
var self = this
361-
process.nextTick(function(){
362-
for (var i=0; i<n_transfers; i++) self.emit('drain')
363-
})
364-
}
365-
366-
function out_ep_callback(err, d){
367-
if (err) this.emit('error', err);
368-
this._pendingTransfers--;
369-
if (this._pendingTransfers < this._streamTransfers){
370-
this.emit('drain');
371-
}
372-
if (this._pendingTransfers <= 0 && this._streamTransfers == 0){
373-
this.emit('end');
374-
}
375-
}
376-
377-
usb.OutEndpoint.prototype.write = function write(data){
378-
this.transfer(data, out_ep_callback);
379-
this._pendingTransfers++;
380-
}
381-
382-
usb.OutEndpoint.prototype.stopStream = function stopStream(){
383-
this._streamTransfers = 0;
384-
this.streamActive = false;
385-
if (this._pendingTransfers === null) throw new Error('stopStream invoked on non-active stream.');
386-
if (this._pendingTransfers == 0) this.emit('end');
387-
}

0 commit comments

Comments
 (0)