11

I'm sending an out bulk transfer, and I stall it in the device (I write the code on both end of the cable) to abort the action. I'm sending a home-made control transfert SET_FEATURE ENDPOINT_HALT to the endpoint and when the abort is complete, I follow up with a CLEAR_FEATURE ENDPOINT_HALT to recover the endpoint and use it again. In the embedded debugger I can confirm it has been cleared in the device. But in the browser, any subsequent transfer on the endpoint will end up with the very unhelpful "Transfer failed" message (code 1).

if (errorCode == 4) {
    var ENDPOINT_HALT = 0;
    var CLEAR_FEATURE = 0x01;
    controlTransfer(currentDevice, {direction: 'out', recipient: 'endpoint', requestType: 'standard',
    request: CLEAR_FEATURE, value: ENDPOINT_HALT, index: 1, data: new ArrayBuffer(0)}, genericErrorFilter());
}

From what I found on the Internet, libusb has a special function for clearing a stall on the host side, to tell the kernel that the endpoint has been recovered, and it should reflect that in its internal structures. This function is not exposed in chrome.usb.

Is there a way to recover from a stall in Chrome? Or is there an alternative recoverable way from the device to stop an ongoing out bulk transfer?

I'm using Mac OS X and Chrome Canary.

nraynaud
  • 4,924
  • 7
  • 39
  • 54
  • I think I managed to carry on after a stall by doing a chrome.usb.resetDevice() followed by a full re-acquisition of the device. – nraynaud Dec 18 '13 at 14:00
  • 5
    The ratio edits/anwers is over the roof, I'll soon have a Shakespeare quality unanswered question. – nraynaud Dec 19 '13 at 10:05

1 Answers1

1

You can try a interruptTransfer on your catched stall message

chrome.experimental.usb.interruptTransfer(integer device,
string direction,
integer endpoint,
string data,
function callback)
RecycleRobot
  • 801
  • 2
  • 11
  • 19