Last active
November 6, 2024 14:10
-
-
Save noosphere2/1d867b7d941abde3f02636a54a1f8495 to your computer and use it in GitHub Desktop.
Fix for ps3 eye microphone on a raspberry pi requiring a physical unplug / reconnect on reboot to be useable as capture device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Logically eject and re-enable driver for Playstation Eye on a Pi running Raspbian Jessie. | |
# This is necessary because on boot, the microphone on the Eye will appear in `lsusb` and | |
# `arecord -l`, but will not function correctly (error "audio open error: Device or | |
# resource busy" or error "read error: Input/output error"). | |
# Can read about others having this problem here https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=14903 | |
# and here https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=15851&p=160394#p160394 | |
# point a cronjob to this file, using the special @reboot nickname to run at startup. | |
cd /sys/bus/usb/drivers/usb | |
device="1-1.4" | |
# 1-1.4 Refers to my ps3 eye device. | |
# | | |_ Device | |
# | |___ Port | |
# |_____ Bus | |
# Find yours by running $ lsusb --tree | |
disconnect() { | |
sudo sh -c "echo ${device} > unbind" | |
} | |
reconnect() { | |
sudo sh -c "echo ${device} > bind" | |
} | |
sleep 10 | |
disconnect | |
sleep 2 | |
reconnect | |
sleep 5 | |
disconnect | |
sleep 2 | |
reconnect | |
logger "Virtually unplugged / plugged in the ps3 eye. Microphone should be working. Test with $ arecord -vvv /dev/null" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment