On my RasPi board, Debian Linux, the USB microphone occasionally gets locked up such that nothing can use it. The microphone has a LED which is usually flashing, when it's locked, it turns off.
arecord describes it as follows:
card 1: Device [DYNEX USB MIC Device], device 0:USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
When the microphone stops working,
arecord gives diagnostics like this:
> arecord -D plughw:1,0 > recording.wav Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono arecord: set_params:1145: Unable to install hw_params: ACCESS: RW_INTERLEAVED FORMAT: U8 etc...
Unplugging and plugging the microphone fixes it, only because the current dip forces the RasPi to reboot! Not an ideal situation.
Is there a way to fix this from the command line or a C executable?
I also tried using
ioctl(fd, USBDEVFS_RESET, 0) using the output from
lsusb to provide the bus and device number. That turns the LED back on, but it's overkill. The device has to be re-setup using alsamixer.