2009-12-01 23:48:41

by Daniel Ritz

[permalink] [raw]
Subject: [PATCH] uvcvideo: add another YUYV format GUID

For some unknown reason, on a MacBookPro5,3 the iSight _sometimes_ report
a different video format GUID. This patch add the other (wrong) GUID to
the format table, making the iSight work always w/o other problems.

What it should report: 32595559-0000-0010-8000-00aa00389b71
What it often reports: 32595559-0000-0010-8000-000000389b71

Signed-off-by: Daniel Ritz <[email protected]>
---
drivers/media/video/uvc/uvc_driver.c | 5 +++++
drivers/media/video/uvc/uvcvideo.h | 3 +++
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index 8756be5..c5af0a2 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -58,6 +58,11 @@ static struct uvc_format_desc uvc_fmts[] = {
.fcc = V4L2_PIX_FMT_YUYV,
},
{
+ .name = "YUV 4:2:2 (YUYV)",
+ .guid = UVC_GUID_FORMAT_YUY2_2,
+ .fcc = V4L2_PIX_FMT_YUYV,
+ },
+ {
.name = "YUV 4:2:0 (NV12)",
.guid = UVC_GUID_FORMAT_NV12,
.fcc = V4L2_PIX_FMT_NV12,
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
index e7958aa..f18eac2 100644
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -112,6 +112,9 @@ struct uvc_xu_control {
#define UVC_GUID_FORMAT_YUY2 \
{ 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
+#define UVC_GUID_FORMAT_YUY2_2 \
+ { 'Y', 'U', 'Y', '2', 0x00, 0x00, 0x10, 0x00, \
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9b, 0x71}
#define UVC_GUID_FORMAT_NV12 \
{ 'N', 'V', '1', '2', 0x00, 0x00, 0x10, 0x00, \
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
--
1.6.3.3



2009-12-04 00:49:07

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] uvcvideo: add another YUYV format GUID

Hi Daniel,

On Wednesday 02 December 2009 00:48:44 Daniel Ritz wrote:
> For some unknown reason, on a MacBookPro5,3 the iSight

Could you please send me the output of lsusb -v both with the correct and
wrong GUID ?

> _sometimes_ report a different video format GUID.

Sometimes only ? Now that's weird. Is that completely random ?

> This patch add the other (wrong) GUID to the format table, making the iSight
> work always w/o other problems.
>
> What it should report: 32595559-0000-0010-8000-00aa00389b71
> What it often reports: 32595559-0000-0010-8000-000000389b71
>
> Signed-off-by: Daniel Ritz <[email protected]>

--
Regards,

Laurent Pinchart

2009-12-04 02:05:39

by Daniel Ritz

[permalink] [raw]
Subject: Re: [PATCH] uvcvideo: add another YUYV format GUID

Hi Laurent

On Thu, 2009-12-03 at 21:15 +0100, Laurent Pinchart wrote:
> Hi Daniel,
>
> On Wednesday 02 December 2009 00:48:44 Daniel Ritz wrote:
> > For some unknown reason, on a MacBookPro5,3 the iSight
>
> Could you please send me the output of lsusb -v both with the correct and
> wrong GUID ?

sure. i attached three files:
isight-good.txt, isight-bad.txt, isight-good2.txt

this is three reboots in a row from like 10 minutes ago. the first
boot into linux was actually rebooting from OSX...first cold boot
today directly into linux had the right GUID.

>
> > _sometimes_ report a different video format GUID.
>
> Sometimes only ? Now that's weird. Is that completely random ?

yes, sometimes only. it seems to be related to reboots, but i don't
know what exactly triggers it. rmmod/modprobe doesn't trigger it.
also, when the wrong GUID is reported, the only way of fixing it is
to reboot. it really is just the GUID. even when the wrong one is
reported, the device works just fine.

i started with a plain ubuntu 9.10, kernel 2.6.31 which was supposed
to fail, so i upgraded to a 2.6.32-rc8 to fix the iSight and some other
things, just to see it fail again. a reboot later and it worked, some
time and reboot later it failed again...

rgds
-daniel

> > This patch add the other (wrong) GUID to the format table, making the iSight
> > work always w/o other problems.
> >
> > What it should report: 32595559-0000-0010-8000-00aa00389b71
> > What it often reports: 32595559-0000-0010-8000-000000389b71
> >
> > Signed-off-by: Daniel Ritz <[email protected]>
>
> --
> Regards,
>
> Laurent Pinchart


Attachments:
isight-bad.txt (17.95 kB)
isight-good.txt (17.95 kB)
isight-good2.txt (17.95 kB)
Download all attachments

2009-12-04 04:59:28

by Justin P. Mattock

[permalink] [raw]
Subject: Re: [PATCH] uvcvideo: add another YUYV format GUID

On 12/03/09 18:05, Daniel Ritz wrote:
> Hi Laurent
>
> On Thu, 2009-12-03 at 21:15 +0100, Laurent Pinchart wrote:
>> Hi Daniel,
>>
>> On Wednesday 02 December 2009 00:48:44 Daniel Ritz wrote:
>>> For some unknown reason, on a MacBookPro5,3 the iSight
>>
>> Could you please send me the output of lsusb -v both with the correct and
>> wrong GUID ?
>
> sure. i attached three files:
> isight-good.txt, isight-bad.txt, isight-good2.txt
>
> this is three reboots in a row from like 10 minutes ago. the first
> boot into linux was actually rebooting from OSX...first cold boot
> today directly into linux had the right GUID.
>
>>
>>> _sometimes_ report a different video format GUID.
>>
>> Sometimes only ? Now that's weird. Is that completely random ?
>
> yes, sometimes only. it seems to be related to reboots, but i don't
> know what exactly triggers it. rmmod/modprobe doesn't trigger it.
> also, when the wrong GUID is reported, the only way of fixing it is
> to reboot. it really is just the GUID. even when the wrong one is
> reported, the device works just fine.
>
> i started with a plain ubuntu 9.10, kernel 2.6.31 which was supposed
> to fail, so i upgraded to a 2.6.32-rc8 to fix the iSight and some other
> things, just to see it fail again. a reboot later and it worked, some
> time and reboot later it failed again...
>
> rgds
> -daniel
>
>>> This patch add the other (wrong) GUID to the format table, making the iSight
>>> work always w/o other problems.
>>>
>>> What it should report: 32595559-0000-0010-8000-00aa00389b71
>>> What it often reports: 32595559-0000-0010-8000-000000389b71
>>>
>>> Signed-off-by: Daniel Ritz<[email protected]>
>>
>> --
>> Regards,
>>
>> Laurent Pinchart
>

I get weiredness whenever
I shutdown the machine and then boot.
If I boot, then reboot things work.

Justin P. Mattock

2009-12-08 15:04:51

by Daniel Ritz

[permalink] [raw]
Subject: Re: [PATCH] uvcvideo: add another YUYV format GUID

On 04.12.2009 05:59, Justin P. Mattock wrote:
> On 12/03/09 18:05, Daniel Ritz wrote:
>> Hi Laurent
>>
>> On Thu, 2009-12-03 at 21:15 +0100, Laurent Pinchart wrote:
>>> Hi Daniel,
>>>
>>> On Wednesday 02 December 2009 00:48:44 Daniel Ritz wrote:
>>>> For some unknown reason, on a MacBookPro5,3 the iSight
>>> Could you please send me the output of lsusb -v both with the correct and
>>> wrong GUID ?
>> sure. i attached three files:
>> isight-good.txt, isight-bad.txt, isight-good2.txt
>>
>> this is three reboots in a row from like 10 minutes ago. the first
>> boot into linux was actually rebooting from OSX...first cold boot
>> today directly into linux had the right GUID.
>>
>>>> _sometimes_ report a different video format GUID.
>>> Sometimes only ? Now that's weird. Is that completely random ?
>> yes, sometimes only. it seems to be related to reboots, but i don't
>> know what exactly triggers it. rmmod/modprobe doesn't trigger it.
>> also, when the wrong GUID is reported, the only way of fixing it is
>> to reboot. it really is just the GUID. even when the wrong one is
>> reported, the device works just fine.
>>
>> i started with a plain ubuntu 9.10, kernel 2.6.31 which was supposed
>> to fail, so i upgraded to a 2.6.32-rc8 to fix the iSight and some other
>> things, just to see it fail again. a reboot later and it worked, some
>> time and reboot later it failed again...
>>
>> rgds
>> -daniel
>>
>>>> This patch add the other (wrong) GUID to the format table, making the iSight
>>>> work always w/o other problems.
>>>>
>>>> What it should report: 32595559-0000-0010-8000-00aa00389b71
>>>> What it often reports: 32595559-0000-0010-8000-000000389b71
>>>>
>>>> Signed-off-by: Daniel Ritz<[email protected]>
>>> --
>>> Regards,
>>>
>>> Laurent Pinchart
>
> I get weiredness whenever
> I shutdown the machine and then boot.
> If I boot, then reboot things work.
>

interesting...does my little patch work for you as well?

thanks
-daniel

> Justin P. Mattock
>

2009-12-10 01:44:49

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] uvcvideo: add another YUYV format GUID

Hi Daniel,

On Friday 04 December 2009 03:05:37 Daniel Ritz wrote:
> Hi Laurent
>
> On Thu, 2009-12-03 at 21:15 +0100, Laurent Pinchart wrote:
> > Hi Daniel,
> >
> > On Wednesday 02 December 2009 00:48:44 Daniel Ritz wrote:
> > > For some unknown reason, on a MacBookPro5,3 the iSight
> >
> > Could you please send me the output of lsusb -v both with the correct and
> > wrong GUID ?
>
> sure. i attached three files:
> isight-good.txt, isight-bad.txt, isight-good2.txt
>
> this is three reboots in a row from like 10 minutes ago. the first
> boot into linux was actually rebooting from OSX...first cold boot
> today directly into linux had the right GUID.

Thanks. diff'ing the descriptors shows something interesting (from good to
good2):

@@ -264,7 +264,7 @@
dwMaxVideoFrameBufferSize 614400
dwDefaultFrameInterval 333333
bFrameIntervalType 11
- dwFrameInterval( 0) 3758429717
+ dwFrameInterval( 0) 333333
dwFrameInterval( 1) 363636
dwFrameInterval( 2) 400000
dwFrameInterval( 3) 444444

3758429717 is 0xe0051615 in hex, and 333333 is 0x00051615.

I wonder what other parts of the descriptors could get corrupted that way.

> > > _sometimes_ report a different video format GUID.
> >
> > Sometimes only ? Now that's weird. Is that completely random ?
>
> yes, sometimes only. it seems to be related to reboots, but i don't
> know what exactly triggers it. rmmod/modprobe doesn't trigger it.
> also, when the wrong GUID is reported, the only way of fixing it is
> to reboot. it really is just the GUID. even when the wrong one is
> reported, the device works just fine.
>
> i started with a plain ubuntu 9.10, kernel 2.6.31 which was supposed
> to fail, so i upgraded to a 2.6.32-rc8 to fix the iSight and some other
> things, just to see it fail again. a reboot later and it worked, some
> time and reboot later it failed again...

All of those are warm reboots, and you don't boot any alternative OS in-
between, right ?

Does Linux reload the iSight firmware at every boot ? If it does, could you
try to reload the firmware manually when you get a "bad" GUID to see if it
helps ? You will probably need to unload the uvcvideo driver before reloading
the firmware.

--
Regards,

Laurent Pinchart

2009-12-10 16:34:23

by Daniel Ritz

[permalink] [raw]
Subject: Re: [PATCH] uvcvideo: add another YUYV format GUID

On Thu, 2009-12-10 at 02:46 +0100, Laurent Pinchart wrote:
> Hi Daniel,
>
> On Friday 04 December 2009 03:05:37 Daniel Ritz wrote:
> > Hi Laurent
> >
> > On Thu, 2009-12-03 at 21:15 +0100, Laurent Pinchart wrote:
> > > Hi Daniel,
> > >
> > > On Wednesday 02 December 2009 00:48:44 Daniel Ritz wrote:
> > > > For some unknown reason, on a MacBookPro5,3 the iSight
> > >
> > > Could you please send me the output of lsusb -v both with the correct and
> > > wrong GUID ?
> >
> > sure. i attached three files:
> > isight-good.txt, isight-bad.txt, isight-good2.txt
> >
> > this is three reboots in a row from like 10 minutes ago. the first
> > boot into linux was actually rebooting from OSX...first cold boot
> > today directly into linux had the right GUID.
>
> Thanks. diff'ing the descriptors shows something interesting (from good to
> good2):
>
> @@ -264,7 +264,7 @@
> dwMaxVideoFrameBufferSize 614400
> dwDefaultFrameInterval 333333
> bFrameIntervalType 11
> - dwFrameInterval( 0) 3758429717
> + dwFrameInterval( 0) 333333
> dwFrameInterval( 1) 363636
> dwFrameInterval( 2) 400000
> dwFrameInterval( 3) 444444
>
> 3758429717 is 0xe0051615 in hex, and 333333 is 0x00051615.
>
> I wonder what other parts of the descriptors could get corrupted that way.

hmm..dunno..but even with this it just worked.

>
> > > > _sometimes_ report a different video format GUID.
> > >
> > > Sometimes only ? Now that's weird. Is that completely random ?
> >
> > yes, sometimes only. it seems to be related to reboots, but i don't
> > know what exactly triggers it. rmmod/modprobe doesn't trigger it.
> > also, when the wrong GUID is reported, the only way of fixing it is
> > to reboot. it really is just the GUID. even when the wrong one is
> > reported, the device works just fine.
> >
> > i started with a plain ubuntu 9.10, kernel 2.6.31 which was supposed
> > to fail, so i upgraded to a 2.6.32-rc8 to fix the iSight and some other
> > things, just to see it fail again. a reboot later and it worked, some
> > time and reboot later it failed again...
>
> All of those are warm reboots, and you don't boot any alternative OS in-
> between, right ?

yes, linux only.

>
> Does Linux reload the iSight firmware at every boot ? If it does, could you
> try to reload the firmware manually when you get a "bad" GUID to see if it
> helps ? You will probably need to unload the uvcvideo driver before reloading
> the firmware.
>
linux does not load isight firmware at all. the new macbooks don't
require to load FW the device just "works".
FW loading is only required for the devices with ID 0x05AC:0x8300,
what i have is 05ac:8507....

rgds
-daniel

2009-12-11 01:19:47

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] uvcvideo: add another YUYV format GUID

On Thursday 10 December 2009 17:34:25 Daniel Ritz wrote:
> On Thu, 2009-12-10 at 02:46 +0100, Laurent Pinchart wrote:
> > Hi Daniel,
> >
> > On Friday 04 December 2009 03:05:37 Daniel Ritz wrote:
> > > Hi Laurent
> > >
> > > On Thu, 2009-12-03 at 21:15 +0100, Laurent Pinchart wrote:
> > > > Hi Daniel,
> > > >
> > > > On Wednesday 02 December 2009 00:48:44 Daniel Ritz wrote:
> > > > > For some unknown reason, on a MacBookPro5,3 the iSight
> > > >
> > > > Could you please send me the output of lsusb -v both with the correct
> > > > and wrong GUID ?
> > >
> > > sure. i attached three files:
> > > isight-good.txt, isight-bad.txt, isight-good2.txt
> > >
> > > this is three reboots in a row from like 10 minutes ago. the first
> > > boot into linux was actually rebooting from OSX...first cold boot
> > > today directly into linux had the right GUID.
> >
> > Thanks. diff'ing the descriptors shows something interesting (from good
> > to good2):
> >
> > @@ -264,7 +264,7 @@
> > dwMaxVideoFrameBufferSize 614400
> > dwDefaultFrameInterval 333333
> > bFrameIntervalType 11
> > - dwFrameInterval( 0) 3758429717
> > + dwFrameInterval( 0) 333333
> > dwFrameInterval( 1) 363636
> > dwFrameInterval( 2) 400000
> > dwFrameInterval( 3) 444444
> >
> > 3758429717 is 0xe0051615 in hex, and 333333 is 0x00051615.
> >
> > I wonder what other parts of the descriptors could get corrupted that
> > way.
>
> hmm..dunno..but even with this it just worked.
>
> > > > > _sometimes_ report a different video format GUID.
> > > >
> > > > Sometimes only ? Now that's weird. Is that completely random ?
> > >
> > > yes, sometimes only. it seems to be related to reboots, but i don't
> > > know what exactly triggers it. rmmod/modprobe doesn't trigger it.
> > > also, when the wrong GUID is reported, the only way of fixing it is
> > > to reboot. it really is just the GUID. even when the wrong one is
> > > reported, the device works just fine.
> > >
> > > i started with a plain ubuntu 9.10, kernel 2.6.31 which was supposed
> > > to fail, so i upgraded to a 2.6.32-rc8 to fix the iSight and some other
> > > things, just to see it fail again. a reboot later and it worked, some
> > > time and reboot later it failed again...
> >
> > All of those are warm reboots, and you don't boot any alternative OS in-
> > between, right ?
>
> yes, linux only.
>
> > Does Linux reload the iSight firmware at every boot ? If it does, could
> > you try to reload the firmware manually when you get a "bad" GUID to see
> > if it helps ? You will probably need to unload the uvcvideo driver before
> > reloading the firmware.
>
> linux does not load isight firmware at all. the new macbooks don't
> require to load FW the device just "works".
> FW loading is only required for the devices with ID 0x05AC:0x8300,
> what i have is 05ac:8507....

Ok, thanks for the information.

I guess the camera is really broken. As MacOSX probably doesn't even try to
parse the USB descriptors, the Apple developers never noticed.

Anyway, I'll apply your patch. Can I still keep your SoB line if I rename
YUY2_2 to YUY2_ISIGHT ?

--
Regards,

Laurent Pinchart

2009-12-11 10:19:35

by Daniel Ritz

[permalink] [raw]
Subject: Re: [PATCH] uvcvideo: add another YUYV format GUID

On 11.12.2009 02:21, Laurent Pinchart wrote:
> On Thursday 10 December 2009 17:34:25 Daniel Ritz wrote:
>> On Thu, 2009-12-10 at 02:46 +0100, Laurent Pinchart wrote:
>>> Hi Daniel,
>>>
>>> On Friday 04 December 2009 03:05:37 Daniel Ritz wrote:
>>>> Hi Laurent
>>>>
>>>> On Thu, 2009-12-03 at 21:15 +0100, Laurent Pinchart wrote:
>>>>> Hi Daniel,
>>>>>
>>>>> On Wednesday 02 December 2009 00:48:44 Daniel Ritz wrote:
>>>>>> For some unknown reason, on a MacBookPro5,3 the iSight
>>>>>
>>>>> Could you please send me the output of lsusb -v both with the correct
>>>>> and wrong GUID ?
>>>>
>>>> sure. i attached three files:
>>>> isight-good.txt, isight-bad.txt, isight-good2.txt
>>>>
>>>> this is three reboots in a row from like 10 minutes ago. the first
>>>> boot into linux was actually rebooting from OSX...first cold boot
>>>> today directly into linux had the right GUID.
>>>
>>> Thanks. diff'ing the descriptors shows something interesting (from good
>>> to good2):
>>>
>>> @@ -264,7 +264,7 @@
>>> dwMaxVideoFrameBufferSize 614400
>>> dwDefaultFrameInterval 333333
>>> bFrameIntervalType 11
>>> - dwFrameInterval( 0) 3758429717
>>> + dwFrameInterval( 0) 333333
>>> dwFrameInterval( 1) 363636
>>> dwFrameInterval( 2) 400000
>>> dwFrameInterval( 3) 444444
>>>
>>> 3758429717 is 0xe0051615 in hex, and 333333 is 0x00051615.
>>>
>>> I wonder what other parts of the descriptors could get corrupted that
>>> way.
>>
>> hmm..dunno..but even with this it just worked.
>>
>>>>>> _sometimes_ report a different video format GUID.
>>>>>
>>>>> Sometimes only ? Now that's weird. Is that completely random ?
>>>>
>>>> yes, sometimes only. it seems to be related to reboots, but i don't
>>>> know what exactly triggers it. rmmod/modprobe doesn't trigger it.
>>>> also, when the wrong GUID is reported, the only way of fixing it is
>>>> to reboot. it really is just the GUID. even when the wrong one is
>>>> reported, the device works just fine.
>>>>
>>>> i started with a plain ubuntu 9.10, kernel 2.6.31 which was supposed
>>>> to fail, so i upgraded to a 2.6.32-rc8 to fix the iSight and some other
>>>> things, just to see it fail again. a reboot later and it worked, some
>>>> time and reboot later it failed again...
>>>
>>> All of those are warm reboots, and you don't boot any alternative OS in-
>>> between, right ?
>>
>> yes, linux only.
>>
>>> Does Linux reload the iSight firmware at every boot ? If it does, could
>>> you try to reload the firmware manually when you get a "bad" GUID to see
>>> if it helps ? You will probably need to unload the uvcvideo driver before
>>> reloading the firmware.
>>
>> linux does not load isight firmware at all. the new macbooks don't
>> require to load FW the device just "works".
>> FW loading is only required for the devices with ID 0x05AC:0x8300,
>> what i have is 05ac:8507....
>
> Ok, thanks for the information.
>
> I guess the camera is really broken. As MacOSX probably doesn't even try to
> parse the USB descriptors, the Apple developers never noticed.
>
> Anyway, I'll apply your patch. Can I still keep your SoB line if I rename
> YUY2_2 to YUY2_ISIGHT ?

sure.

thanks, rgds
-daniel