Add fix command and troubleshooting for errno=16 error
- Add 'fix' command to diagnose CEC connection issues - Add detailed troubleshooting section for common errors - Fix handles errno=16 (device busy) by checking processes and trying sudo - Document solutions for CEC permission and connection issues Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,7 @@ Commands:
|
||||
scan Scan for CEC devices
|
||||
status Show CEC adapter status
|
||||
info Show TV information
|
||||
fix Troubleshoot connection issues
|
||||
|
||||
raw <command> Send raw CEC command (hex)
|
||||
|
||||
@@ -136,6 +137,46 @@ raw_command() {
|
||||
send_command "tx $cmd"
|
||||
}
|
||||
|
||||
fix_connection() {
|
||||
echo "Attempting to fix CEC connection issues..."
|
||||
echo ""
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "Checking for existing CEC processes..."
|
||||
pgrep -a cec-client || echo "No cec-client processes found"
|
||||
echo ""
|
||||
echo "Trying with sudo - you may need to enter your password:"
|
||||
echo ""
|
||||
sudo "$0" "$@"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "Running as root - checking CEC device status..."
|
||||
echo ""
|
||||
|
||||
# Check if device exists
|
||||
if [ -e /dev/cec0 ]; then
|
||||
echo "CEC device /dev/cec0 exists"
|
||||
ls -l /dev/cec0
|
||||
echo ""
|
||||
|
||||
# Check what's using the device
|
||||
echo "Checking what's using the CEC device:"
|
||||
lsof /dev/cec0 2>/dev/null || echo "Nothing is locking /dev/cec0"
|
||||
echo ""
|
||||
else
|
||||
echo "Warning: /dev/cec0 does not exist"
|
||||
echo "Available devices:"
|
||||
ls -la /dev/cec* /dev/tty* 2>/dev/null | grep -E "cec|ttyAMA|ttyS0" || echo "No CEC devices found"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo "Attempting to scan for devices..."
|
||||
echo ""
|
||||
$CEC_CLIENT -s -d 1 < /dev/null
|
||||
}
|
||||
|
||||
# Main script logic
|
||||
case "$1" in
|
||||
tv-on)
|
||||
@@ -174,6 +215,9 @@ case "$1" in
|
||||
info)
|
||||
show_info
|
||||
;;
|
||||
fix)
|
||||
fix_connection
|
||||
;;
|
||||
raw)
|
||||
raw_command "$2"
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user