Re: usb: gadget: webcam broken?

2017-03-07 Thread Roger Quadros

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: usb: gadget: webcam broken?

2017-03-06 Thread Petr Cvek
Dne 2.3.2017 v 09:19 Roger Quadros napsal(a):
> Petr,
> 
> On 02/03/17 06:57, Petr Cvek wrote:
>> Dne 2.3.2017 v 00:22 Laurent Pinchart napsal(a):
>>> Hi Roger,
>>>
>>> On Wednesday 01 Mar 2017 17:09:51 Roger Quadros wrote:
 Hi,

 I'm no longer able to use g_webcam with uvc-gadget [1] since v4.9. Logs at
 the end. It looks like we're goofing up on the control endpoint.

 If I revert the following commit everything works fine.
 commit 4fbac5206afd01b717d4bdc58793d471f3391b4b
 Author: Petr Cvek 
 Date:   Wed Aug 17 12:36:57 2016 +0200

 usb: gadget: uvc: Add missing call for additional setup data

 Am I missing something on uvc-gadget side or is the commit really bad?
 From what I understand, uvc-gadget is responsible for sending response to
 UVC class specific requests on control endpoint in uvc_send_response()
 in uvc_v4l2.c.

 So the reported commit is sending a duplicate response with probably
 improper data.
>>>
>>> Yes, this looks very dubious to me. I think it should be reverted. My 
>>> apologies for not having caught the patch during review.
>>
>> Hi,
>>
>> Now I've watched all codepaths again and yeah it is probably wrong patch, 
>> sorry.
>>
>> But if the code path is really:
>>
>> uvc_function_setup() -> userspace setup -> ioctl UVCIOC_SEND_RESPONSE -> 
>> uvc_send_response() -> usb_ep_queue() -> uvc_function_ep0_complete() -> 
>> userspace data
>>
>> it seems the USB timeouts with my hardware (PXA27x UDC) but with my patch it 
>> gets response immediately.
>>
> 
> I hope you were running uvc-gadget application on the PXA27x.
> 
> Just sending a response is not sufficient. It must send a response with 
> proper data.
> f_uvc itself doesn't know how to handle UVC class specific requests and has to
> depend on the user space application to populate the data in the response.
> 

Hi,

Yeah it was on the PXA27x, but that callback is not working there, so I was 
mistaken the bug is in UVC and not in PXA27x UDC itself.

Anyway I was using a newer (unofficial [1]) version of uvc-gadget, which 
already implements the most of the UVC requests.

BTW Did you try to use a configfs method for your usb webcam application? There 
was a discussion [2] about removing legacy UDC stuff (g_webcam and others g_*) 
in the future. If you used it, does it create these files for you?
streaming_interval
streaming_maxpacket
streaming_maxburst

P.S. Are you planning to use some generic linux friendly USB VID/PID? ;-)

[1] 
https://github.com/madscientist42/uvc-gadget/commit/e127ec3a3022e1090b3b741b48f661670f5dade2
[2] http://www.spinics.net/lists/linux-usb/msg152678.html

--
cheers,
Petr

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: usb: gadget: webcam broken?

2017-03-04 Thread Roger Quadros
Petr,

On 02/03/17 06:57, Petr Cvek wrote:
> Dne 2.3.2017 v 00:22 Laurent Pinchart napsal(a):
>> Hi Roger,
>>
>> On Wednesday 01 Mar 2017 17:09:51 Roger Quadros wrote:
>>> Hi,
>>>
>>> I'm no longer able to use g_webcam with uvc-gadget [1] since v4.9. Logs at
>>> the end. It looks like we're goofing up on the control endpoint.
>>>
>>> If I revert the following commit everything works fine.
>>> commit 4fbac5206afd01b717d4bdc58793d471f3391b4b
>>> Author: Petr Cvek 
>>> Date:   Wed Aug 17 12:36:57 2016 +0200
>>>
>>> usb: gadget: uvc: Add missing call for additional setup data
>>>
>>> Am I missing something on uvc-gadget side or is the commit really bad?
>>> From what I understand, uvc-gadget is responsible for sending response to
>>> UVC class specific requests on control endpoint in uvc_send_response()
>>> in uvc_v4l2.c.
>>>
>>> So the reported commit is sending a duplicate response with probably
>>> improper data.
>>
>> Yes, this looks very dubious to me. I think it should be reverted. My 
>> apologies for not having caught the patch during review.
> 
> Hi,
> 
> Now I've watched all codepaths again and yeah it is probably wrong patch, 
> sorry.
> 
> But if the code path is really:
> 
> uvc_function_setup() -> userspace setup -> ioctl UVCIOC_SEND_RESPONSE -> 
> uvc_send_response() -> usb_ep_queue() -> uvc_function_ep0_complete() -> 
> userspace data
> 
> it seems the USB timeouts with my hardware (PXA27x UDC) but with my patch it 
> gets response immediately.
> 

I hope you were running uvc-gadget application on the PXA27x.

Just sending a response is not sufficient. It must send a response with proper 
data.
f_uvc itself doesn't know how to handle UVC class specific requests and has to
depend on the user space application to populate the data in the response.

-- 
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: usb: gadget: webcam broken?

2017-03-01 Thread Petr Cvek
Dne 2.3.2017 v 00:22 Laurent Pinchart napsal(a):
> Hi Roger,
> 
> On Wednesday 01 Mar 2017 17:09:51 Roger Quadros wrote:
>> Hi,
>>
>> I'm no longer able to use g_webcam with uvc-gadget [1] since v4.9. Logs at
>> the end. It looks like we're goofing up on the control endpoint.
>>
>> If I revert the following commit everything works fine.
>> commit 4fbac5206afd01b717d4bdc58793d471f3391b4b
>> Author: Petr Cvek 
>> Date:   Wed Aug 17 12:36:57 2016 +0200
>>
>> usb: gadget: uvc: Add missing call for additional setup data
>>
>> Am I missing something on uvc-gadget side or is the commit really bad?
>> From what I understand, uvc-gadget is responsible for sending response to
>> UVC class specific requests on control endpoint in uvc_send_response()
>> in uvc_v4l2.c.
>>
>> So the reported commit is sending a duplicate response with probably
>> improper data.
> 
> Yes, this looks very dubious to me. I think it should be reverted. My 
> apologies for not having caught the patch during review.

Hi,

Now I've watched all codepaths again and yeah it is probably wrong patch, sorry.

But if the code path is really:

uvc_function_setup() -> userspace setup -> ioctl UVCIOC_SEND_RESPONSE -> 
uvc_send_response() -> usb_ep_queue() -> uvc_function_ep0_complete() -> 
userspace data

it seems the USB timeouts with my hardware (PXA27x UDC) but with my patch it 
gets response immediately.

Petr

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: usb: gadget: webcam broken?

2017-03-01 Thread Laurent Pinchart
Hi Roger,

On Wednesday 01 Mar 2017 17:09:51 Roger Quadros wrote:
> Hi,
> 
> I'm no longer able to use g_webcam with uvc-gadget [1] since v4.9. Logs at
> the end. It looks like we're goofing up on the control endpoint.
> 
> If I revert the following commit everything works fine.
> commit 4fbac5206afd01b717d4bdc58793d471f3391b4b
> Author: Petr Cvek 
> Date:   Wed Aug 17 12:36:57 2016 +0200
> 
> usb: gadget: uvc: Add missing call for additional setup data
> 
> Am I missing something on uvc-gadget side or is the commit really bad?
> From what I understand, uvc-gadget is responsible for sending response to
> UVC class specific requests on control endpoint in uvc_send_response()
> in uvc_v4l2.c.
> 
> So the reported commit is sending a duplicate response with probably
> improper data.

Yes, this looks very dubious to me. I think it should be reverted. My 
apologies for not having caught the patch during review.

Would you like to send a revert patch ?

> [1] - git://git.ideasonboard.org/uvc-gadget.git

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


usb: gadget: webcam broken?

2017-03-01 Thread Roger Quadros
Hi,

I'm no longer able to use g_webcam with uvc-gadget [1] since v4.9. Logs at the 
end.
It looks like we're goofing up on the control endpoint.

If I revert the following commit everything works fine.
commit 4fbac5206afd01b717d4bdc58793d471f3391b4b
Author: Petr Cvek 
Date:   Wed Aug 17 12:36:57 2016 +0200

usb: gadget: uvc: Add missing call for additional setup data

Am I missing something on uvc-gadget side or is the commit really bad?
>From what I understand, uvc-gadget is responsible for sending response to
UVC class specific requests on control endpoint in uvc_send_response()
in uvc_v4l2.c.

So the reported commit is sending a duplicate response with probably
improper data.

[1] - git://git.ideasonboard.org/uvc-gadget.git

-- 
cheers,
-roger

Logs:
-
#gadget side:

open succeeded, file descriptor = 3
device is dwc3-gadget on bus gadget
bRequestType a1 bRequest 87 wValue 0100 wIndex 0001 wLength 001a
streaming request (req 87 [UVC_GET_DEF], cs 01)
uvc_events_process: event 0x804, response length 34
bRequestType 21 bRequest 01 wValue 0100 wIndex 0001 wLength 001a
streaming request (req 01 [UVC_SET_CUR], cs 01)
uvc_events_process: event 0x804, response length 34
setting probe control, length = 26
bRequestType a1 bRequest 81 wValue 0100 wIndex 0001 wLength 001a
streaming request (req 81 [UVC_GET_CUR], cs 01)
uvc_events_process: event 0x804, response length 34

#Host side
[27398.977099] usb 2-1.2: new high-speed USB device number 54 using ehci-pci
[27399.072799] usb 2-1.2: New USB device found, idVendor=1d6b, idProduct=0102
[27399.072809] usb 2-1.2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[27399.072814] usb 2-1.2: Product: Webcam gadget
[27399.072818] usb 2-1.2: Manufacturer: Linux Foundation
[27399.097437] uvcvideo: Found UVC 1.00 device Webcam gadget (1d6b:0102)
[27399.109341] input: Webcam gadget as 
/devices/pci:00/:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/input/input69
[27409.542335] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: 
-110 (exp. 2).
[27409.842264] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: 
-110 (exp. 2).
[27409.846363] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 
(exp. 2).
[27409.850602] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 
(exp. 2).
[27442.242779] usb 2-1.2: reset high-speed USB device number 54 using ehci-pci
[27442.326540] usb 2-1.2: device descriptor read/64, error -71
[27442.514512] usb 2-1.2: device descriptor read/64, error -71
[27442.690526] usb 2-1.2: reset high-speed USB device number 54 using ehci-pci
[27442.774509] usb 2-1.2: device descriptor read/64, error -71
[27442.962526] usb 2-1.2: device descriptor read/64, error -71
[27443.138490] usb 2-1.2: reset high-speed USB device number 54 using ehci-pci
[27443.554484] usb 2-1.2: device not accepting address 54, error -71
[27443.626516] usb 2-1.2: reset high-speed USB device number 54 using ehci-pci
[27444.042433] usb 2-1.2: device not accepting address 54, error -71
[27444.045025] usb 2-1.2: USB disconnect, device number 54
[27444.154454] usb 2-1.2: new high-speed USB device number 55 using ehci-pci
[27444.238442] usb 2-1.2: device descriptor read/64, error -71
[27444.426487] usb 2-1.2: device descriptor read/64, error -71
[27444.602429] usb 2-1.2: new high-speed USB device number 56 using ehci-pci
[27444.686421] usb 2-1.2: device descriptor read/64, error -71
[27444.874416] usb 2-1.2: device descriptor read/64, error -71
[27445.050419] usb 2-1.2: new high-speed USB device number 57 using ehci-pci
[27445.466363] usb 2-1.2: device not accepting address 57, error -71
[27445.538361] usb 2-1.2: new high-speed USB device number 58 using ehci-pci
[27445.954311] usb 2-1.2: device not accepting address 58, error -71
[27445.956294] usb 2-1-port2: unable to enumerate USB device



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html