Re: Failed control transfer

From: Daniel O'Connor <darius_at_dons.net.au>
Date: Tue, 11 Oct 2022 10:05:47 UTC

> On 11 Oct 2022, at 17:27, Hans Petter Selasky <hps@selasky.org> wrote:
> 
> On 10/11/22 06:18, Daniel O'Connor wrote:
>> I am trying to fix a bug in xc3sprog whereby it can't read the hardware ID (serial number) from the Xilinx programming tool.
> 
> Sometimes you need to ask for 255 bytes and allow the control transfer to short terminate. Many USB devices are broken this way, that they cannot return partial USB descriptors.

I tried that but no dice:
In [6]: d.ctrl_transfer(0xc0, 176, 0x42, 0, 256, 1000)
---------------------------------------------------------------------------
USBError                                  Traceback (most recent call last)
...
USBError: [Errno 19] No device

The device does do short transfers for other requests, eg a version request:
In [7]: d.ctrl_transfer(0xc0, 176, 0x50, 258, 2, 100)
Out[7]: array('B', [5, 0])

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum