Re: uvideo0: can't find interface assoc descriptor

2020-05-30 Thread Patrick Wildt
On Sat, May 30, 2020 at 07:47:17PM +0200, Jan Stary wrote:
> On May 30 18:50:12, h...@stare.cz wrote:
> > This is current/amd64 on a MacBook2,1 (dmesg below)
> > With the latest upgrade, it has lost video0:
> > 
> > uvideo0 at uhub0 port 4 configuration 1 interface 0 "Micron Built-in 
> > iSight" rev 2.00/1.84 addr 2
> > uvideo0: can't find interface assoc descriptor
> 
> Similar thing happens with current/i386 on a MacBook1,1 (dmesg below):
> uvideo0: can't find video interface
> 
>   Jan

Yeah, this is due to the change to support multiple cameras in one
device.  You can try this diff, let me know if this works on both
of your machines.

Patrick

diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index d33e3079acd..da00d0d3d0d 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -510,6 +510,8 @@ uvideo_attach(struct device *parent, struct device *self, 
void *aux)
int i;
 
sc->sc_udev = uaa->device;
+   sc->sc_iface = uaa->ifaceno;
+   sc->sc_nifaces = uaa->nifaces;
 
/* Find the first unclaimed video interface. */
for (i = 0; i < uaa->nifaces; i++) {
@@ -521,10 +523,8 @@ uvideo_attach(struct device *parent, struct device *self, 
void *aux)
if (id->bInterfaceClass == UICLASS_VIDEO)
break;
}
-   if (i == uaa->nifaces) {
-   printf("%s: can't find video interface\n", DEVNAME(sc));
-   return;
-   }
+   if (i == uaa->nifaces)
+   goto attach;
 
/* Find out which interface association we belong to. */
usbd_desc_iter_init(sc->sc_udev, );
@@ -540,30 +540,38 @@ uvideo_attach(struct device *parent, struct device *self, 
void *aux)
break;
desc = usbd_desc_iter_next();
}
-   if (desc == NULL) {
-   printf("%s: can't find interface assoc descriptor\n",
-   DEVNAME(sc));
-   return;
-   }
+   if (desc != NULL) {
+   /*
+* Claim all interfaces of our association.  Interfaces must be
+* claimed during attach, during attach hooks is too late.
+*/
+   for (i = iad->bFirstInterface;
+   i < iad->bFirstInterface + iad->bInterfaceCount; i++) {
+   if (usbd_iface_claimed(sc->sc_udev, i)) {
+   printf("%s: interface already claimed\n",
+   DEVNAME(sc));
+   return;
+   }
+   usbd_claim_iface(sc->sc_udev, i);
+   }
 
-   /*
-* Claim all interfaces of our association.  Interfaces must be
-* claimed during attach, during attach hooks is too late.
-*/
-   for (i = iad->bFirstInterface;
-   i < iad->bFirstInterface + iad->bInterfaceCount; i++) {
-   if (usbd_iface_claimed(sc->sc_udev, i)) {
-   printf("%s: interface already claimed\n",
-   DEVNAME(sc));
-   return;
+   /* Remember our association by saving the first interface. */
+   sc->sc_iface = iad->bFirstInterface;
+   sc->sc_nifaces = iad->bInterfaceCount;
+   } else {
+   /* No association, so simply claim them all. */
+   for (i = 0; i < uaa->nifaces; i++) {
+   if (usbd_iface_claimed(sc->sc_udev, i))
+   continue;
+   id = 
usbd_get_interface_descriptor(>sc_udev->ifaces[i]);
+   if (id == NULL)
+   continue;
+   if (id->bInterfaceClass == UICLASS_VIDEO)
+   usbd_claim_iface(sc->sc_udev, i);
}
-   usbd_claim_iface(sc->sc_udev, i);
}
 
-   /* Remember our association by saving the first interface. */
-   sc->sc_iface = iad->bFirstInterface;
-   sc->sc_nifaces = iad->bInterfaceCount;
-
+attach:
/* maybe the device has quirks */
sc->sc_quirk = uvideo_lookup(uaa->vendor, uaa->product);
 



Re: uvideo0: can't find interface assoc descriptor

2020-05-30 Thread Jan Stary
On May 30 18:50:12, h...@stare.cz wrote:
> This is current/amd64 on a MacBook2,1 (dmesg below)
> With the latest upgrade, it has lost video0:
> 
> uvideo0 at uhub0 port 4 configuration 1 interface 0 "Micron Built-in iSight" 
> rev 2.00/1.84 addr 2
> uvideo0: can't find interface assoc descriptor

Similar thing happens with current/i386 on a MacBook1,1 (dmesg below):
uvideo0: can't find video interface

Jan



OpenBSD 6.7-current (GENERIC.MP) #211: Fri May 29 14:45:41 MDT 2020
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
real mem  = 2113323008 (2015MB)
avail mem = 2059005952 (1963MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 07/29/05, SMBIOS rev. 2.4 @ 0xe7490 (36 entries)
bios0: vendor Apple Computer, Inc. version "MB11.88Z.0061.B03.0610121324" date 
10/12/06
bios0: Apple Computer, Inc. MacBook1,1
acpi0 at bios0: ACPI 3.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP HPET APIC MCFG ASF! SBST ECDT SSDT SSDT SSDT
acpi0: wakeup devices ADP1(S3) LID0(S3) PXS1(S4) PXS2(S4) USB1(S3) USB2(S3) 
USB3(S3) USB4(S3) USB7(S3) EC__(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Genuine Intel(R) CPU T2500 @ 2.00GHz ("GenuineIntel" 686-class) 2 GHz, 
06-0e-08
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,MWAIT,VMX,EST,TM2,xTPR,PDCM,NXE,PERF,SENSOR,MELTDOWN
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 166MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Genuine Intel(R) CPU T2500 @ 2.00GHz ("GenuineIntel" 686-class) 2 GHz, 
06-0e-08
cpu1: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,MWAIT,VMX,EST,TM2,xTPR,PDCM,NXE,PERF,SENSOR,MELTDOWN
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins, remapped
acpimcfg0 at acpi0
acpimcfg0: addr 0xe000, bus 0-255
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (RP01)
acpiprt2 at acpi0: bus 2 (RP02)
acpiprt3 at acpi0: bus 3 (PCIB)
acpicpu0 at acpi0: !C4(100@55 mwait@0x31), !C3(500@1 mwait@0x20), !C2(500@1 
mwait@0x10), C1(1000@1 mwait), PSS
acpicpu1 at acpi0: !C4(100@55 mwait@0x31), !C3(500@1 mwait@0x20), !C2(500@1 
mwait@0x10), C1(1000@1 mwait), PSS
acpisbs0 at acpi0: SBS0 model "ASMB016" serial 35580 type LION oem "DP"
acpiac0 at acpi0: AC unit online
acpibtn0 at acpi0: LID0
"APP0002" at acpi0 not configured
acpibtn1 at acpi0: PWRB
acpibtn2 at acpi0: SLPB
"PNP0A08" at acpi0 not configured
"APP0001" at acpi0 not configured
"APP0003" at acpi0 not configured
"ACPI0001" at acpi0 not configured
"IFX0101" at acpi0 not configured
acpicmos0 at acpi0
acpivideo0 at acpi0: GFX0
bios0: ROM list: 0xc/0xe600!
cpu0: Enhanced SpeedStep 1998 MHz: speeds: 2000, 1833, 1667, 1500, 1333, 1000 
MHz
memory map conflict 0xe00f8000/0x1000
memory map conflict 0xfed1c000/0x4000
memory map conflict 0xfffb/0x3
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82945GM Host" rev 0x03
inteldrm0 at pci0 dev 2 function 0 "Intel 82945GM Video" rev 0x03
drm0 at inteldrm0
intagp0 at inteldrm0
agp0 at intagp0: aperture at 0x8000, size 0x1000
inteldrm0: apic 1 int 16, I945GM, gen 3
"Intel 82945GM Video" rev 0x03 at pci0 dev 2 function 1 not configured
vendor "Intel", unknown product 0x27a3 (class DASP subclass Time and Frequency, 
rev 0x03) at pci0 dev 7 function 0 not configured
azalia0 at pci0 dev 27 function 0 "Intel 82801GB HD Audio" rev 0x02: msi
azalia0: codecs: Sigmatel STAC9220/1
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 82801GB PCIE" rev 0x02: apic 1 int 17
pci1 at ppb0 bus 1
mskc0 at pci1 dev 0 function 0 "Marvell Yukon 88E8053" rev 0x22, Yukon-2 EC 
rev. A3 (0x2): apic 1 int 16
msk0 at mskc0 port A: address 00:16:cb:d0:c4:3c
eephy0 at msk0 phy 0: 88E Gigabit PHY, rev. 2
ppb1 at pci0 dev 28 function 1 "Intel 82801GB PCIE" rev 0x02: apic 1 int 16
pci2 at ppb1 bus 2
ath0 at pci2 dev 0 function 0 "Atheros AR5424" rev 0x01: apic 1 int 17
ath0: AR5424 10.3 phy 6.1 rf 10.2 eeprom 5.3, WORAW, address 00:16:cb:bf:f6:88
uhci0 at pci0 dev 29 function 0 "Intel 82801GB USB" rev 0x02: apic 1 int 21
uhci1 at pci0 dev 29 function 1 "Intel 82801GB USB" rev 0x02: apic 1 int 19
uhci2 at pci0 dev 29 function 2 "Intel 82801GB USB" rev 0x02: apic 1 int 18
uhci3 at pci0 dev 29 function 3 "Intel 82801GB USB" rev 0x02: apic 1 int 16
ehci0 at pci0 dev 29 function

uvideo0: can't find interface assoc descriptor

2020-05-30 Thread Jan Stary
This is current/amd64 on a MacBook2,1 (dmesg below)
With the latest upgrade, it has lost video0:

uvideo0 at uhub0 port 4 configuration 1 interface 0 "Micron Built-in iSight" 
rev 2.00/1.84 addr 2
uvideo0: can't find interface assoc descriptor
ugen0 at uhub0 port 4 configuration 1 "Micron Built-in iSight" rev 2.00/1.84 
addr 2

Before this (previous dmesg also below), it was video0 at uvideo0,
after first ataching as "Apple Computer Bluetooth",
then detaching, and reataching correctly:

uvideo0 at uhub0 port 4 configuration 1 interface 0 "Apple Computer Bluetooth" 
rev 2.00/0.0c addr 2
uvideo0 detached
uvideo0 at uhub0 port 4 configuration 1 interface 0 "Micron Built-in iSight" 
rev 2.00/1.84 addr 2
video0 at uvideo0

The current kernel is compiled with UVIDEO_DEBUG
but I don't see any video-specific debug messages.
Ouput of lsusb -v also below.

How can I help debug this?

Jan


OpenBSD 6.7-current (GENERIC.MP) #0: Sat May 30 17:45:54 CEST 2020
h...@mb64.stare.cz:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 3171909632 (3024MB)
avail mem = 3063046144 (2921MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe (37 entries)
bios0: vendor Apple Inc. version "MB21.88Z.00A5.B07.0706270922" date 06/27/07
bios0: Apple Inc. MacBook2,1
acpi0 at bios0: ACPI 3.0
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP HPET APIC MCFG ASF! SBST ECDT SSDT SSDT SSDT
acpi0: wakeup devices ADP1(S3) LID0(S3) PXS1(S4) PXS2(S4) USB1(S3) USB2(S3) 
USB3(S3) USB4(S3) USB7(S3) EC__(S3)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 CPU T7400 @ 2.16GHz, 2161.59 MHz, 06-0f-06
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR,MELTDOWN
cpu0: 4MB 64b/line 16-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 166MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 CPU T7400 @ 2.16GHz, 2161.28 MHz, 06-0f-06
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR,MELTDOWN
cpu1: 4MB 64b/line 16-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins, remapped
acpimcfg0 at acpi0
acpimcfg0: addr 0xf000, bus 0-255
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (RP01)
acpiprt2 at acpi0: bus 2 (RP02)
acpiprt3 at acpi0: bus 3 (PCIB)
acpicpu0 at acpi0: !C3(100@55 mwait@0x31), !C2(500@1 mwait@0x10), C1(1000@1 
mwait), PSS
acpicpu1 at acpi0: !C3(100@55 mwait@0x31), !C2(500@1 mwait@0x10), C1(1000@1 
mwait), PSS
acpisbs0 at acpi0: SBS0 model "ASMB016" serial 19351 type LION oem "DP"
acpiac0 at acpi0: AC unit online
acpibtn0 at acpi0: LID0
"APP0002" at acpi0 not configured
acpibtn1 at acpi0: PWRB
acpibtn2 at acpi0: SLPB
acpipci0 at acpi0 PCI0: 0x0010 0x0011 0xmemory map conflict 
0xbef0/0x10
memory map conflict 0xbf00/0x100
memory map conflict 0xf00f8000/0x1000
memory map conflict 0xfed1c000/0x4000
memory map conflict 0xfffb/0x3

extent `acpipci0 pcibus' (0x0 - 0xff), flags=0
extent `pciio' (0x0 - 0x), flags=0
 0x1 - 0x
extent `pcimem' (0x0 - 0x), flags=0
 0x0 - 0xbfff
 0xf000 - 0xf3ff
 0xfec0 - 0xfec00fff
 0xfed14000 - 0xfed19fff
 0xfed1c000 - 0xfed1
 0xfee0 - 0xfee00fff
 0xffe0 - 0x
 0x400 - 0x
"APP0001" at acpi0 not configured
"APP0003" at acpi0 not configured
"ACPI0001" at acpi0 not configured
acpicmos0 at acpi0
acpivideo0 at acpi0: GFX0
cpu0: Enhanced SpeedStep 2161 MHz: speeds: 2167, 2000, 1833, 1667, 1500, 1333, 
1000 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82945GM Host" rev 0x03
inteldrm0 at pci0 dev 2 function 0 "Intel 82945GM Video" rev 0x03
drm0 at inteldrm0
intagp0 at inteldrm0
agp0 at intagp0: aperture at 0xc000, size 0x1000
inteldrm0: apic 1 int 16, I945GM, gen 3
"Intel 82945GM Video" rev 0x03 at pci0 dev 2 function 1 not configured
vendor "Intel", unknown product 0x27a3 (class DASP subclass Time and Frequency, 
rev 0x03) at pci0 dev 7 function 0 not configured
azalia0 at pci0 dev 27 function 0 "Intel 82801GB HD Audio" rev 0x02: msi
azalia0: codecs: Sigmatel STAC922