2015-08-13 15:11 GMT+02:00 Martin Pieuchot <m...@openbsd.org>:
> On 23/07/15(Thu) 17:52, Ludovic Coues wrote:
>> On 17/07/15(Fri) 17:53, Ludovic Coues wrote:
>> > Following yesterday feedback, I wrote a patch merging
>> > usb_video_header_desc and usb_video_header_desc_all in uvideo.c .
>> > Current kernel compile fine with it on amd64 and video display image.
>> >
>> > At the moment, I can't test the patch on other platform. So I'm looking
>> > for feedback, on the pattern used and if it change anything on
>> > non-amd64. If those are positive, there is a couple of structure I would
>> > alter in the same way.
>>
>> As I got no feedback on this one, I've gone ahead and changed a few more
>> structure and fixed code using these in uvideo.c .
>>
>> usb_video_header_desc and usb_video_input_header_desc where separated
>> into two structure for historical limitation.
>> usb_video_input_terminal_desc has been turned into a fixed length
>> structure by following the 1.5 specification. Last field isn't a pointer
>> anymore but an array of length 3. I have no reason to believe the 1.5
>> spec break backward compatibility with 1.1 so I assume this change won't
>> break existing video usb device. Same logic is applied to
>> usb_video_vc_processing_desc. As a bonus, this one get direct access to the 2
>> last field.
>> Lastly, usb_video_frame_desc got it last field. Prior to this patch,
>> data where accessed by pointer arithmetic. Now, data are in their own
>> field. The trick is when bFrameIntervalType is set to 0, it's followed
>> by 3 values. When it's set to non-zero value, it's the number of
>> following value. To represent that, I've made the last value a unamed
>> union with 2 named struct. This work well on amd64 but I don't know if
>> all version of gcc will accept such structure.
>>
>> With this patch and the one adding missing descriptor, uvideo should be
>> up to date with the 1.5 version of the usb video specification;
>
> With this diff I get the following error on my x220:
>
> uvideo_vs_negotiation: uvideo0: no frame descriptors found!
>
> I have this camera:
>
> uvideo0 at uhub3 port 6 configuration 1 interface 0 "Chicony Electronics
> Co., Ltd. Integrated Camera" rev 2.00/8.54 addr 3
>
> And the descriptor dump:
>
> Bus 000 Device 003: ID 04f2:b217 Chicony Electronics Co., Ltd Lenovo 
> Integrated Camera (0.3MP)
> Device Descriptor:

>       VideoControl Interface Descriptor:
>         bLength                11
>         bDescriptorType        36
>         bDescriptorSubtype      5 (PROCESSING_UNIT)
>       Warning: Descriptor too short
>         bUnitID                 2
>         bSourceID               1
>         wMaxMultiplier          0
>         bControlSize            2
>         bmControls     0x0000157f
>           Brightness
>           Contrast
>           Hue
>           Saturation
>           Sharpness
>           Gamma
>           White Balance Temperature
>           Backlight Compensation
>           Power Line Frequency
>           White Balance Temperature, Auto
>         iProcessing             0
>         bmVideoStandards     0x1b
>           None
>           NTSC - 525/60
>           SECAM - 625/50
>           NTSC - 625/50

I haven't any clue yet on why that happen.
But that dump show that the diff is wrong. I have assumed bControlSize
to be always 3 for usb_video_input_terminal_desc and
usb_video_vc_processing_desc, as it's a constant in the spec 1.5 .
Obviously, that the value can be less than 3 with device following the
spec 1.00

-- 

Cordialement, Coues Ludovic
+336 148 743 42

Reply via email to