Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Current page fault trap when plugging in a USB DAC



Hi,

This email describes two separate issues. The first is a system crash that is 
clearly a code bug and should be relatively easy to fix. The second part 
describes a failure of the USB code to find a matching sample rate for the USB 
DAC. I do not know whether this is also a code bug, a configuration issue, or 
a missing feature in NetBSD.

By mistake I sent an incomplete version of this email yesterday. This email 
should be complete.

I'm seeing the following crash when plugging in a Benchmark DAC1 USB into a
NetBSD 5.99.52 am64 system:

page fault trap , code 0
Stopped in pid 0.50 (system) at netbsd:audio_calcwater+0x1c ...
db{1}> bt
audio_calcwater
audiosetinfo
...

The page fault is caused by using a null sc->sc_pustream pointer at line #1372 
in sys/dev/audio.c:

(gdb) list *0xffffffff801cf09d
0xffffffff801cf09d is in audio_calcwater (/usr/src/sys/dev/audio.c:1372).
1367    audio_calcwater(struct audio_softc *sc)
1368    {
1369
1370            /* set high at 100% */
1371            if (audio_can_playback(sc)) {
1372                    sc->sc_pr.usedhigh =
1373                        sc->sc_pustream->end - sc->sc_pustream->start;
1374                    /* set low at 75% of usedhigh */
1375                    sc->sc_pr.usedlow = sc->sc_pr.usedhigh * 3 / 4;
1376                    if (sc->sc_pr.usedlow == sc->sc_pr.usedhigh)

This happens because the call to hw->set_params(...) in audiosetinfo fails 
(with EINVAL) and the "goto cleanup" error path calls audio_calcwater without 
clearing the AUDIO_PROP_PLAYBACK prop flag and without initializing the sc-
>sc_pustream pointer. I suppose a quick-and-dirty fix might be to clear the 
prop flags in the error path of audiosetinfo.

As to why the hw->set_params(...) call fails I would very much appreciate 
pointers. For the device in question, it is a call to uaudio_set_params which 
in turn calls auconv_set_converter. The latter reports:

auconv_set_converter: ENTER rateconv=1
[ 0]: mode=PLAY enc=slinera_lu 24/24bit 2ch channel_mask=STEREO 44100Hz, 
48000Hz, 88200Hz, 96000Hz

and searches through:
        native format
        native with aurateconv
        encoding emulation
        encoding emulation with aurateconv
before returning the error -1 (at the bottom)

As far as I can tell, auconv_set_converter only tests for less than or equal 
to 16bits, sampling rates of 8000Hz and, strangly, up to 12 channels. I do not 
see 24 bit or any CD quality sampling rates.

Here are some kernel messages that may be relevant:

uhci0 at pci0 dev 26 function 0: vendor 0x8086 product 0x2937 (rev. 0x03)
uhci0: interrupting at ioapic0 pin 20
usb0 at uhci0: USB revision 1.0
ehci0 at pci0 dev 26 function 7: vendor 0x8086 product 0x293c (rev. 0x03)
ehci0: interrupting at ioapic0 pin 23
ehci0: EHCI version 1.0
ehci0: companion controllers, 2 ports each: uhci0 uhci1 uhci2

uaudio0 at uhub0 port 1 configuration 1 interface 0
uaudio0: Texas Instruments Benchmark 1.0, rev 1.00/1.00, addr 2
id 5:   AC_INPUT type=UAT_STREAM
        cluster: bNrChannels=2 wChannelConfig=0x0003<LEFT,RIGHT> iChannelNames=0
        input0: UAT_STREAM
        output: UAIO_SPEAKER
id 8: AC_OUTPUT type=UATO_SPEAKER src=5
        input0: UAT_STREAM
        output: UAIO_SPEAKER
uadio_identify_ac: id=5 subtype=2
uadio_identify_ac: id=8 subtype=3
...
(this last part was hand copied)

Regards,
Sverre




Home | Main Index | Thread Index | Old Index