The USB microphone occasionally gets locked up such that nothing can use it.

The utility 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:

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 saw something using ioctl(fd, USBDEVFS_RESET, 0) but no idea which filename to open to correspond to device and not sure if that would work anyway.

  • Would a better power supply be an option? A powered hub? Aug 13 '13 at 5:54
  • It's already using its own dedicated power supply - "the best!". The dip is because the RasPi has a current limiter, so regardless of how good the power supply is, it will shut off when this microphone is plugged into it. So maybe the option should be getting a better microphone!
    – Yimin Rong
    Aug 20 '13 at 16:23
  • Use a separate USB hub with its own power supply. Then it wont reset.
    – Piotr Kula
    Nov 11 '13 at 9:25

You could use lsof to see what process is locking the device

lsof | grep /dev/snd

for example, and maybe kill the offending process if there's a process locking it.

  • Doesn't show up in lsof, tried grepping dev, snd, usb and pcm not seeing anything.
    – Yimin Rong
    Jun 14 '13 at 13:04
  • killall arecord ?
    – Piotr Kula
    Nov 11 '13 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.