On Tue, Apr 23, 2024 at 4:23 AM Alexandre Ratchov wrote:
> > > On Mon, Apr 22, 2024 at 01:14:43PM -0300, Thanos Tsouanas wrote:
> > > > [...]
> > > > uaudio0: class v1, full-speed, sync, channels: 0 play, 0 rec, 3 ctls
> > >
> > > 0 channels seems wrong. So, you confirm that this device used to work?
> >
> > Yes: it has been my main audio interface for OpenBSD ever
> > since 2018 that I bought it; it has worked perfectly on all
> > releases up to now.
> >
> > Just to rule out the possibility of a coincidence of
> > hardware failure at the moment of my sysupgrade, I plugged
> > it on a mac mini and it works. To be honest I am not 100%
> > sure I can rule out *some* hardware issue, because its
> > volume on the mac mini is about 60% of what it used to be
> > (until yesterday!) on OpenBSD (in both cases set to 100%,
> > rest of my audio setup identical).
> >
> > Until yesterday, it has always been plugged on my OpenBSD
> > computer and working perfectly (and loudly).
> >
> > I will install a 7.4 system on a usb stick just to verify
> > that the issue is indeed related with the 7.4->7.5 upgrade.
>
> Could you try the diff below? possibly set the UAUDIO_DEBUG
> option in your kernel config to better see what's going on.
>
> BTW, there's a single change in the uaudio driver between
> openbsd 7.4 and 7.5, so a quick workaround would be to
> revert it.
>
> In any case, could you run the program attached to this mail
> and send me its output? It would allow me to test parts of
> the uaudio driver on your device.
>
> First, run 'usbdevs' to figure out the bus and address
> numbers of the device, then run 'uacdump ' and
> send me its output.
>
> Thanks
>
> Index: uaudio.c
> ===
> RCS file: /cvs/src/sys/dev/usb/uaudio.c,v
> diff -u -p -u -p -r1.174 uaudio.c
> --- uaudio.c10 Dec 2023 06:32:14 - 1.174
> +++ uaudio.c23 Apr 2024 07:01:59 -
> @@ -2702,6 +2702,22 @@ uaudio_fixup_params(struct uaudio_softc
> }
> }
>
> +int
> +uaudio_iface_index(struct uaudio_softc *sc, int ifnum)
> +{
> + int i, nifaces;
> +
> + nifaces = sc->udev->cdesc->bNumInterfaces;
> +
> + for (i = 0; i < nifaces; i++) {
> + if (sc->udev->ifaces[i].idesc->bInterfaceNumber == ifnum)
> + return i;
> + }
> +
> + printf("%s: %d: invalid interface number\n", __func__, ifnum);
> + return -1;
> +}
> +
> /*
> * Parse all descriptors and build configuration of the device.
> */
> @@ -2711,6 +2727,7 @@ uaudio_process_conf(struct uaudio_softc
> struct uaudio_blob dp;
> struct uaudio_alt *a;
> unsigned int type, ifnum, altnum, nep, class, subclass;
> + int i;
>
> while (p->rptr != p->wptr) {
> if (!uaudio_getdesc(p, ))
> @@ -2736,7 +2753,8 @@ uaudio_process_conf(struct uaudio_softc
>
> switch (subclass) {
> case UISUBCLASS_AUDIOCONTROL:
> - if (usbd_iface_claimed(sc->udev, ifnum)) {
> + i = uaudio_iface_index(sc, ifnum);
> + if (i != -1 && usbd_iface_claimed(sc->udev, i)) {
> DPRINTF("%s: %d: AC already claimed\n",
> __func__, ifnum);
> break;
> }
> @@ -2748,7 +2766,8 @@ uaudio_process_conf(struct uaudio_softc
> return 0;
> break;
> case UISUBCLASS_AUDIOSTREAM:
> - if (usbd_iface_claimed(sc->udev, ifnum)) {
> + i = uaudio_iface_index(sc, ifnum);
> + if (i != -1 && usbd_iface_claimed(sc->udev, i)) {
> DPRINTF("%s: %d: AS already claimed\n",
> __func__, ifnum);
> break;
> }
> @@ -2768,10 +2787,19 @@ done:
> * Claim all interfaces we use. This prevents other uaudio(4)
> * devices from trying to use them.
> */
> - for (a = sc->alts; a != NULL; a = a->next)
> - usbd_claim_iface(sc->udev, a->ifnum);
> + for (a = sc->alts; a != NULL; a = a->next) {
> + i = uaudio_iface_index(sc, a->ifnum);
> + if (i != -1) {
> + DPRINTF("%s: claim: %d at %d\n", __func__, a->ifnum,
> i);
> + usbd_claim_iface(sc->udev, i);
> + }
> + }
>
> - usbd_claim_iface(sc->udev, sc->ctl_ifnum);
> + i = uaudio_iface_index(sc, sc->ctl_ifnum);
> + if (i != -1) {
> + DPRINTF("%s: claim: ac %d at %d\n", __func__, sc->ctl_ifnum,
> i);
> + usbd_claim_iface(sc->udev, i);
> + }
>
> return 1;
> }
So, the good news is that it seems to be a hardware problem:
I installed 7.4 on a usb stick just to test it and it did
work, but when I booted back to the same 7.5 that it didn't,