[sane-devel] reverse engineering / usbsnoop
Henning Meier-Geinitz
henning@meier-geinitz.de
Sun, 12 Sep 2004 10:52:09 +0200
Hi,
On Sat, Sep 11, 2004 at 07:07:01PM -0400, Mbosowo I Sampson wrote:
No. 1:
> SetupPacket:
> 0000: 80 06 00 01 00 00 12 00
> bmRequestType: 80
> DIR: Device-To-Host
So this URB is the answer to a request from the host.
> TYPE: Standard
No vendor-specific command.
> RECIPIENT: Device
The request was sent to the device as a whole (not a specific
interface or endpoint).
> bRequest: 06
> GET_DESCRIPTOR
That's a standard request.
> Descriptor Type: 0x0001
> DEVICE
We want to get the device descriptor (wValue = 1).
No. 2:
> 0000: 80 06 00 02 00 00 09 00
> bmRequestType: 80
> DIR: Device-To-Host
> TYPE: Standard
> RECIPIENT: Device
> bRequest: 06
> GET_DESCRIPTOR
> Descriptor Type: 0x0002
> CONFIGURATION
Same as above but this time we want to get the configuration
descriptor (wValue = 2). Also we limit the transfer size to 9 bytes
(wLength = 9). That's the minimum size of a descriptor.
> TransferBuffer: 0x00000009 (9) length
> 0000: 09 02 27 00 01 01 00 e0 01
> bLength : 0x09 (9)
> bDescriptorType : 0x02 (2)
> wTotalLength : 0x0027 (39)
But really the descriptor has 0x27 bytes. So we get it again with 0x27
bytes:
No. 3:
> 0000: 80 06 00 02 00 00 27 00
And we got all 0x27 bytes. So these three requests are actually
different.
> 4 ??? down n/a 0.093 SELECT_CONFIGURATION
> URB Header (length: 100)
That's a new request. Now that we have all descriptors, we can set the
configuration (config 0 usually).
Bye,
Henning