#!/bin/sh # main [ "$1" = "start" ] || exit 0 MASTER_ID="" MODPROBE_FILES="" XMODULE="" BLACKLIST="" ASOUND_CONF_DIR="/usr/share/lliurex/llxcfg-hwsupport/asound" for x in $(cat /proc/cmdline); do case $x in modprobe_conf=*) MODPROBE_FILES="${x#modprobe_conf=}" ;; lliurex_master=*) MASTER_ID="${x#lliurex_master=}" ;; tecra_s3) MASTER_ID="PR72" ;; tecra_s4) MASTER_ID="PR73" ;; tx1320) MASTER_ID="PR83" ;; vesa|VESA) XMODULE="vesa" ;; xmodule=*) XMODULE="${x#xmodule=}" ;; XMODULE=*) XMODULE="${x#XMODULE=}" ;; deny_modules=*) BLACKLIST="$(echo ${x#deny_modules=}|tr "," " ")" ;; m-audio24/96-pci=*) ASOUND_DRIVER="ICE1712" ASOUND_DEVICE="${x#m-audio-pci=}" ;; m-audio24/96-pci) ASOUND_DRIVER="ICE1712" ASOUND_DEVICE=0 ;; m-audio192-pci=*) ASOUND_DRIVER="ICE1724" ASOUND_DEVICE="${x#m-audio-pci=}" ;; m-audio192-pci) ASOUND_DRIVER="ICE1724" ASOUND_DEVICE=0 ;; xonar-d2=*) ASOUND_DRIVER="D2" ASOUND_DEVICE="${x#xonar-d2=}" ;; xonar-d2) ASOUND_DRIVER="D2" ASOUND_DEVICE=0 ;; V8233) ASOUND_DRIVER="V8233" ASOUND_DEVICE=0 ;; V8235) ASOUND_DRIVER="V8235" ASOUND_DEVICE=0 ;; V8237) ASOUND_DRIVER="V8237" ASOUND_DEVICE=0 ;; esac done SYSTEM_VARS_LIST="ASOUND_DRIVER ASOUND_DEVICE JACK_INTERFACE_NAMES JACK_INTERFACE_DEVICES $(llxcfg-listvars --names |grep "^HWSUPPORT_")" for v in $SYSTEM_VARS_LIST ; do llxcfg-systemvars del "$v" done # TODO autodeteccion if [ -d /proc/asound/ ] ; then for d in $(find /proc/asound/ -xtype d -name "card?" |sort -g) ; do if [ -r "$d/id" ] ; then ASOUND_NAME="$(cat "$d/id")" if [ "$ASOUND_NAME" = "NVidia" ]; then if [ -r "$d/codec#0" ]; then ASOUND_NAME="$(cat "$d/codec#0" | head -1 | awk '{print $NF}')" fi fi ASOUND_NUMBER=${d##*card} if [ -r "$ASOUND_CONF_DIR/$ASOUND_NAME" ] ; then JACK_INTERFACE_NAMES="$JACK_INTERFACE_NAMES $ASOUND_NAME" JACK_INTERFACE_DEVICES="$JACK_INTERFACE_DEVICES $ASOUND_NUMBER" fi if [ $ASOUND_NAME = "Audiophile192" -o $ASOUND_NAME = "M2496" ] ; then JACK_INTERFACE_NAMES="$JACK_INTERFACE_NAMES $ASOUND_NAME" JACK_INTERFACE_DEVICES="$JACK_INTERFACE_DEVICES $ASOUND_NUMBER" fi if [ -z "$ASOUND_DRIVER" ] ; then ASOUND_DRIVER="$ASOUND_NAME" ASOUND_DEVICE="$ASOUND_NUMBER" fi fi done fi if [ -n "$MASTER_ID" ] ; then case $MASTER_ID in PR73|pr73) MODPROBE_FILES="snd-hda-intel-basic" ;; OR79|or79|OR73|or73|OR77|or77|OR7A|or7a) MODPROBE_FILES="snd-hda-intel-3stack" ;; PR83|pr83) BLACKLIST="usbtouchscreen tkusb" ;; SE72|se72|SE7A|se7a) ASOUND_DRIVER="ICE1712" ASOUND_DEVICE=0 ;; SE82|se82|SE92_36748|se92_36748) ASOUND_DRIVER="ICE1724" ASOUND_DEVICE=0 ;; SE92_35810|se92_35810) ASOUND_DRIVER="D2" ASOUND_DEVICE=0 ;; SEA3) ASOUND_DRIVER="ALC262" ASOUND_DEVICE=0 ;; esac fi if [ "$ASOUND_DRIVER" ] && [ "$ASOUND_DEVICE" ] ; then CONF_FILE="$ASOUND_CONF_DIR/$ASOUND_DRIVER" if [ -r "$CONF_FILE" ] ; then cat "$CONF_FILE" |llxcfg-config write asound/asound.conf llxcfg-systemvars add ASOUND_DEVICE=$ASOUND_DEVICE fi case $ASOUND_DRIVER in V8237 |V8235 | V8233) llxcfg-systemvars add ASOUND_DRIVER="V823x" #MODPROBE_FILES="$MODPROBE_FILES snd-via82xx" ;; ICE1712) llxcfg-systemvars add ASOUND_DRIVER="ICE1712" MODPROBE_FILES="$MODPROBE_FILES snd-ice1712" ;; ICE1724) llxcfg-systemvars add ASOUND_DRIVER="ICE1724" ;; ALC262) llxcfg-systemvars add ASOUND_DRIVER="ALC262" if [ "$(dmidecode -s baseboard-manufacturer |sed -e 's%[[:blank:]]%%g')" = "FUJITSU" ]; then MODPROBE_FILES="$MODPROBE_FILES snd-alc262-fujitsu" fi ;; esac fi if [ "$JACK_INTERFACE_NAMES" -a "$JACK_INTERFACE_DEVICES" ] ; then llxcfg-systemvars add JACK_INTERFACE_NAMES="$JACK_INTERFACE_NAMES" JACK_INTERFACE_DEVICES="$JACK_INTERFACE_DEVICES" fi MODPROBE_SOURCE="/usr/share/lliurex/llxcfg-initramfs/modprobe.d" MODPROBE_TARGET="/etc/modprobe.d" TARGET_FILE="${MODPROBE_TARGET}/lliurex-hwsupport" TMP_FILE="$(tempfile)" rm -f "$TARGET_FILE" # add forced modules if [ "$MODPROBE_FILES" ] ; then MODPROBE_LIST="$(echo "$MODPROBE_FILES" |tr "," " ")" for f in $MODPROBE_LIST ; do if [ -r "${MODPROBE_SOURCE}/${f}" ] ; then cat "${MODPROBE_SOURCE}/${f}" >> "$TMP_FILE" fi done fi # add blacklisted modules if [ "$BLACKLIST" ] ; then for m in $BLACKLIST ; do echo "blacklist $m" >> "$TMP_FILE" done fi # install the real target if [ -s "$TMP_FILE" ] ; then mv -f "$TMP_FILE" "$TARGET_FILE" fi rm -f "$TMP_FILE" if [ "$XMODULE" ] ; then XMODULE="$(echo "$XMODULE" |tr "[:upper:]" "[:lower:]")" llxcfg-xorg-conf set driver "$XMODULE" else llxcfg-xorg-conf unset driver fi exit 0