On 15/07/15(Wed) 17:30, ludovic coues wrote:
> 2015-07-15 17:04 GMT+02:00 Martin Pieuchot <[email protected]>:
> > On 15/07/15(Wed) 16:45, Ludovic Coues wrote:
> >> Following is a diff adding missing USB descriptor to uvideo.h according
> >> to USB Video spec 1.5 . It also update a couple of table reference from
> >> spec 1.1 to 1.5
> >
> > Do not hesitate to explain *why* do you need that, it might not be clear
> > to everybody on this list :)
> >
> 
> Oh, right.
> I'm working on an alternative to lsusb for my summer of code. By
> design, I'm using pretty much every USB descriptor defined by the
> spec.
> 
> >> Index: sys/dev/usb/uvideo.h
> >> ===================================================================
> >> RCS file: /cvs/src/sys/dev/usb/uvideo.h,v
> >> retrieving revision 1.57
> >> diff -u -p -r1.57 uvideo.h
> >> --- sys/dev/usb/uvideo.h      9 Jul 2015 14:58:32 -0000       1.57
> >> +++ sys/dev/usb/uvideo.h      14 Jul 2015 17:24:42 -0000
> >> +/* Table 3-18: Still Image Frame Descriptor */
> >> +struct usb_video_still_image_frame_desc {
> >> +     uByte   bLength;
> >> +     uByte   bDescriptorType;
> >> +     uByte   bDescriptorSubtype;
> >> +     uByte   bEndpointAddress;
> >> +     uByte   bNumImageSizePatterns;
> >> +     uByte   data[1];
> >> +/*   struct {
> >> +             uWord   wWidth;
> >> +             wWord   wHeight;
> >> +     } __packed size[1]; */
> >> +/*   uByte   bNumCompressionPattern; */
> >> +/*   uByte   bCompression[1]; */
> >
> > Why are they commented?
> >
> Mainly as a way to document the spec in the code.
> I could remove the data field and uncomment the size field. I would be
> pretty close to the spec and this struct could be filled with a
> memcpy. But size would be a field of size 32 followed by two field of
> size 8. I don't know how I could access bNumCompressionPattern or
> bCompression in this case.

Is it because by ``wWord'' you mean uDword?  Did you consider using an
union with #define?

Martin

Reply via email to