Re: [RFC/PATCHv2 7/8] usb: gadget: f_ncm.c added

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

>>>>> "KY" == Kaliuta Yauheni writes:

 > +       case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8)
 > +               | USB_CDC_SET_NTB_INPUT_SIZE:
 > +       {
 > +               unsigned in_size;
 > +
 > +               if (w_length != 4 || w_value != 0 || w_index != ncm->ctrl_id)
 > +                       goto invalid;
 > +               in_size = get_unaligned_le32(req->buf);
 > +               if (in_size < NCM_NTB_MIN_IN_SIZE ||
 > +                   in_size > le32_to_cpu(ntb_parameter.dwNtbInMaxSize))
 > +                       goto invalid;
 > +               ncm->port.fixed_in_len = in_size;
 > +               value = 0;
 > +               break;
 > +       }
 > +

This place is completly wrong: there is nothing useful in the req->buf by
that moment. Only SETUP packet is fetched. As far as I got from the
comments, function is responsible to fetch control out packet (well, it
makes sense, because only function can check if data are correct and STALL
endpoint otherwise), but additional logic should be added to store
context.

BTW, for me more clear design would be if composite framework take the
responsibility and issue ACK/STALL depends of result of
f->setup()/c->setup(). 

What do you think?

-- 
WBR, Yauheni Kaliuta
JID: ykaliuta@xxxxxxxxxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux