Hello,
I must now add , that it seems to me ,after adding some printk() messages, that after calling usb_set_interface() with alternate setting 1 (the alternate setting to which I
try to change and with which the application hangs in ioctl () as I al;ready described in my fist post)
the endpoint DOES NOT stall.


What I did is:
I added before , and after , usb_set_interface() , the following 2 printk():

Err(KERN_ERR "[pwc-if.c] pdev->udev->halted[0] %d\n",pdev->udev->halted[0]);
Err(KERN_ERR "[pwc-if.c] pdev->udev->halted[1] %d\n",pdev->udev->halted[1]);


and both values are 0 , before and after the call.

Also when I try to call usb_set_interface() with alternate setting 3, which succeeds and does not hang , all these halt flag values are 0.

I don't know wheterh this check is accurate; after looking at
usb_endpoint_halt macro in usb.h , it seems to me that possibly this
means wheteher the endpoint is halted/stalled or not.

Any help will be appreciated

regards,
John



From: [EMAIL PROTECTED]
To: John Que <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: [linux-usb-devel] usb_set_interface() to a different alternate setting
Date: Tue, 29 Jun 2004 15:07:22 -0500


Quoting John Que <[EMAIL PROTECTED]>:

> Hello,
>
> I work with a logitech 4000 pro WebCam with the pwc driver;
> I run it on RH9 linux with 2.4.20-8 kernel.
>
> The driver is part of the linux kernel 2.4.20-8. (and also above , of
> course).
>
> Now , in pwc_isoc_init() method (in pwc-if.c)
> there is the following call:
> ret = usb_set_interface(pdev->udev, 0, pdev->valternate);
>
> By debugging I saw that it uses alternate setting 2 (pdev->valternate=2).
>
> Now , according to the next Linux Device Driver website , this is the
> descriptor for that webcam: (and I verified it by cat /proc/bus/usb/devices)
>
> http://www.qbik.ch/usb/devices/showdescr.php?id=2515
>
> Now , I had tried to use a different alternate setting,1, for which
> the Maximum Packet Size (MxPS) is 196.
>
> So I set pdev->valternate to 1 in the beginning of the pwc_isoc_init().
>
> the return value form usb_set_interface() is 0 ; this means success.
>
> I also saw the the return value from usb_maxpacket is 196, which is indeed
> the
> max packet size of alternate setting 1.
>
>
> However, when I try to use a utility like ffmpeg to grab a video sequence it
> fails immeditately in the beginning : it simply hangs
> in the pwc_video_ioctl() method. (in the case VIDIOCSYNC: )
>
> I don't understand why; though I added printk() calls almost
> everywhere in that case sentence of this pwc_video_ioctl()
> it does not reach them ; it simply hangs.
>
> My question is :
> Given that descriptor - is it possible and correct to change alternate
> setting like I do ?


There are cameras that stall when changing to alternate settings.  For
those types, it is necessary to stop the camera by changing to alternate
setting 0, and then choose another alternate setting.

> Or should I do something else?
>
> Is it OK that the number of endpoint remains 5 in both cases
> (when using altenate setting 2,which is the default,and when using
> alternate setting 1 ?)
>
This may be dependent on the device, but 5 should arouse suspicions when
there are only 2 endpoints in that setting.  Try getting the device status
just after changing the setting to see if the setting that you choose
did not stall the camera.

> Any help will be appreciated.
>
> The kernel log I got when running the ffmpeg util is below:
> (I added some printing info where I thought it can give some hint):
>
> [pwc-if.c] in pwc_isoc_init
> [pwc-if.c] in pdev->vendpoint = 5
> [pwc-if.c] setting pdev->vmax_packet_size to  196
> [pwc-if.c] usb_set_interface ret= 0
> [pwc-if.c] pipe size is 164736
> [pwc-if.c] epmaxpacketout= 0
> epmaxpacketin 196
> usb_pipeendpoint 5
> [pwc-if.c] pipeout 0
> [pwc-if.c] usb_maxpacket returns  196
> [pwc-if.c] pipe size is 164736
> [pwc-if.c] epmaxpacketout= 0
> [pwc-if.c] epmaxpacketin 196
> [pwc-if.c] usb_pipeendpoint 5
> [pwc-if.c] pipeout 0
> [pwc-if.c] usb_maxpacket returns  196
> [pwc-if.c]  finished pwc_isoc_init()
> [pwc-if.c] finished pwc_video_open
> [pwc-if.c] pwc_video_ioctl
>
> [pwc-if.c] case VIDIOCMCAPTURE:
> VIDIOCMCAPTURE: 352x288, frame 0, format 15
> [pwc-if.c] before pwc_try_video_mode :
> pwc Video mode [EMAIL PROTECTED] fps is only supported with the decompressor module
> (pwcx).
> in pwc_isoc_init
> in pdev->vendpoint = 5
> [pwc-if.c] setting pdev->vmax_packet_size to  196
> [pwc-if.c] usb_set_interface ret= 0
> [pwc-if.c] pipe size is 164736
> [pwc-if.c] epmaxpacketout= 0
> [pwc-if.c] epmaxpacketin 196
> [pwc-if.c] usb_pipeendpoint 5
> [pwc-if.c] pipeout 0
> [pwc-if.c] usb_maxpacket returns  196
> [pwc-if.c] pipe size is 164736
> [pwc-if.c] epmaxpacketout= 0
> [pwc-if.c] epmaxpacketin 196
> [pwc-if.c] usb_pipeendpoint 5
> [pwc-if.c] pipeout 0
> [pwc-if.c] usb_maxpacket returns  196
> [pwc-if.c]  finished pwc_isoc_init()
> [pwc-if.c] after pwc_try_video_mode :
> [pwc-if.c] VIDIOCMCAPTURE done :
> [pwc-if.c] pwc_video_ioctl
> [pwc-if.c] case VIDIOCMCAPTURE:
> VIDIOCMCAPTURE: 352x288, frame 1, format 15
> [pwc-if.c] VIDIOCMCAPTURE done :
> [pwc-if.c] pwc_video_ioctl
> [pwc-if.c] case VIDIOCSYNC:
>
> regards,
> John
>

good luck,
gerald



_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to