usb_audio: Stop before reallocating buffers and add more error checks.
Also print strerror() for SetGlobalFormat.
This commit is contained in:
@@ -832,7 +832,10 @@ Device::_SetupEndpoints()
|
|||||||
|
|
||||||
if (fAudioControl.InitCheck() == B_OK && fStreams.Count() > 0) {
|
if (fAudioControl.InitCheck() == B_OK && fStreams.Count() > 0) {
|
||||||
TRACE(INF, "Found device %#06x:%#06x\n", fVendorID, fProductID);
|
TRACE(INF, "Found device %#06x:%#06x\n", fVendorID, fProductID);
|
||||||
gUSBModule->set_configuration(fDevice, config);
|
|
||||||
|
status_t status = gUSBModule->set_configuration(fDevice, config);
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
for (int i = 0; i < fStreams.Count(); i++)
|
for (int i = 0; i < fStreams.Count(); i++)
|
||||||
fStreams[i]->OnSetConfiguration(fDevice, config);
|
fStreams[i]->OnSetConfiguration(fDevice, config);
|
||||||
|
|||||||
@@ -170,8 +170,10 @@ Stream::_SetupBuffers()
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fArea != -1)
|
if (fArea != -1) {
|
||||||
|
Stop();
|
||||||
delete_area(fArea);
|
delete_area(fArea);
|
||||||
|
}
|
||||||
|
|
||||||
fAreaSize = (sizeof(usb_iso_packet_descriptor) + fPacketSize)
|
fAreaSize = (sizeof(usb_iso_packet_descriptor) + fPacketSize)
|
||||||
* sampleSize * 1024 / fPacketSize;
|
* sampleSize * 1024 / fPacketSize;
|
||||||
@@ -441,9 +443,9 @@ Stream::SetGlobalFormat(multi_format_info* Format)
|
|||||||
USB_AUDIO_SET_CUR, USB_AUDIO_SAMPLING_FREQ_CONTROL << 8,
|
USB_AUDIO_SET_CUR, USB_AUDIO_SAMPLING_FREQ_CONTROL << 8,
|
||||||
address, sizeof(freq), &freq, &actualLength);
|
address, sizeof(freq), &freq, &actualLength);
|
||||||
|
|
||||||
TRACE(ERR, "set_speed %02x%02x%02x for ep %#x %d: %x\n",
|
TRACE(ERR, "set_speed %02x%02x%02x for ep %#x %d: %s\n",
|
||||||
freq.bytes[0], freq.bytes[1], freq.bytes[2],
|
freq.bytes[0], freq.bytes[1], freq.bytes[2],
|
||||||
address, actualLength, status);
|
address, actualLength, strerror(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user