Skip to content

Commit

Permalink
Allow transmission of partial device descriptors, to allow the "old" …
Browse files Browse the repository at this point in the history
…enumeration

scheme of the Linux kernel which has only been recently made available through
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.4.11&id=7cbdf96cda1fbffb17ec26ea65e1fe63c9aed430
  • Loading branch information
abarisani committed Jan 15, 2020
1 parent 04296d7 commit ee270cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion imx6/usb/setup.go
Expand Up @@ -128,8 +128,15 @@ func (hw *usb) doSetup(dev *Device, setup *SetupData) (err error) {

switch bDescriptorType {
case DEVICE:
desc := dev.Descriptor.Bytes()

// the host might request a partial descriptor
if int(setup.wLength) < len(desc) {
desc = desc[0:setup.wLength]
}

log.Printf("imx6_usb: sending device descriptor\n")
err = hw.tx(0, false, dev.Descriptor.Bytes())
err = hw.tx(0, false, desc)
case CONFIGURATION:
var conf []byte
if conf, err = dev.Configuration(index, setup.wLength); err == nil {
Expand Down

0 comments on commit ee270cc

Please sign in to comment.