Author Topic: ATI and Intel correct autodetect round two. Need testers. Very easy.  (Read 11397 times)

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
I believe I have found the problem with ATI and Intel auto-detection.
Please replace /usr/pluto/bin/Utils.sh with the following
Code: [Select]
#!/bin/bash

if [[ -n "$HEADER_Utils" ]]; then
        return 0
fi
HEADER_Utils=included

. /usr/pluto/bin/SQL_Ops.sh
. /usr/pluto/bin/Config_Ops.sh

DEVICETEMPLATE_OnScreen_Orbiter=62
DEVICEDATA_Use_OpenGL_effects=172
DEVICEDATA_Use_alpha_blended_UI=169
DEVICEDATA_PK_UI=104

function AddBookmark {
        return 0
        Url="$1"
        Name="$2"

        [[ ! -f /home/public/bookmarks.html ]] || return 0

        # Generate an id for this bookmark
        ID=$(echo "$Url" | sha1sum)
        ID='rdf:#$'${ID:0:6}

        # Generate the bookmark entry
        Bookmark='   <DT><A HREF="'$Url'" ADD_DATE="1126869382" LAST_MODIFIED="1126869442" ID="'$ID'">'$Name'</A>'
        Bookmark=$(echo $Bookmark | sed 's/"/\\\"/g')

        for BookmarksFile in /home/public/bookmarks.html /home/user_*/bookmarks.html ;do
                # See if the bookmark is already there
                if grep -q "ID=\"$ID\"" $BookmarksFile ;then
                        continue
                fi

                # Add the bookmark string to the file
                awk '
                        BEGIN { HR=0 }
                        HR==0 && /<HR>/ {print "'"$Bookmark"'"; HR=1}
                        {print}
                ' $BookmarksFile > $BookmarksFile.$$
                mv $BookmarksFile.$$ $BookmarksFile
        done

}

function DelBookmark {
        return 0
        Url="$1"
        Name="$2"

        [[ ! -f /home/public/bookmarks.html ]] || return 0

        # Generate an id for this bookmark
        ID=$(echo "$Url" | sha1sum)
        ID='rdf:#$'${ID:0:6}

        for BookmarksFile in /home/public/bookmarks.html /home/user_*/bookmarks.html ;do
                grep -v "ID=\"$ID\"" $BookmarksFile >> $BookmarksFile.$$
                mv $BookmarksFile.$$ $BookmarksFile
        done
}

TranslateSerialPort()
{
        local SearchFor="$1"
        local PCI USB

        SerialPort=
        if [[ "$SearchFor" == pci* ]]; then
                if [[ -d /sys/class/tty ]]; then
                        pushd /sys/class/tty &>/dev/null
                        for dev in ttyUSB*/device ttyACM*/device; do
                                id=$(readlink -f "$dev" | sed -r 's,^.*(pci.*)/usb[0-9]*/[0-9./-]*/[0-9]*-([0-9.]*):[0-9.]*(/ttyUSB[0-9]*)?$,\1+\2,g')
                                if [[ "$id" == "$SearchFor" ]]; then
                                        SerialPort="/dev/$(dirname "$dev")"
                                        break;
                                fi
                        done
                        popd &>/dev/null
                fi
        else
                SerialPort="$SearchFor"
        fi

        builtin echo "$SerialPort"
}

TranslateSoundCard()
{
        local SoundCard="$1" AlsaCard=
        local PCI USB
        local Cards Card Dev

        if [[ -d /sys/class/sound && "$SoundCard" == pci* ]]; then
                if [[ "$SoundCard" == *+* ]]; then
                        PCI="${SoundCard%+*}"
                        USB="${SoundCard#*+}"
                else
                        PCI="${SoundCard}"
                        USB=
                fi
                pushd /sys/class/sound &>/dev/null
                Cards=$(find -name 'controlC*')
                for Card in $Cards; do
                        Card="${Card#./}"
                        Dev=$(readlink "$Card/device"|cut -f3 -d/)
                        if [[ -n "$USB" ]]; then
                                if [[ "$Dev" == *"$PCI"*usb*"$USB:"* ]]; then
                                        AlsaCard="${Card#controlC}"
                                        break
                                fi
                        else
                                if [[ "$PCI" == *"$Dev" ]]; then
                                        AlsaCard="${Card#controlC}"
                                        break
                                fi
                        fi
                done
                popd &>/dev/null
        fi

        builtin echo "$AlsaCard"
}

UseAlternativeLibs()
{
        export LD_LIBRARY_PATH=/opt/libsdl/lib:/opt/libxine/lib:/opt/libsdl1.2-1.2.7+1.2.8cvs20041007/lib:/opt/linphone-1.3.5/lib
}

function ListTemplates_Category {
        local FK_DeviceCategory_Parent="$1"
        local PK_DeviceTemplate_List=""
        local PK_DeviceCategory=""
        local PK_DeviceTemplate=""

        R=$(RunSQL "SELECT PK_DeviceCategory FROM DeviceCategory WHERE FK_DeviceCategory_Parent = $FK_DeviceCategory_Parent")
        for PK_DeviceCategory in $R ;do
                PK_DeviceTemplate_List="$PK_DeviceTemplate_List $(ListTemplates_Category "$PK_DeviceCategory")"
        done

        R=$(RunSQL "SELECT PK_DeviceTemplate FROM DeviceTemplate WHERE FK_DeviceCategory=$FK_DeviceCategory_Parent")
        for PK_DeviceTemplate in $R ;do
                PK_DeviceTemplate_List="$PK_DeviceTemplate_List $PK_DeviceTemplate"
        done

        echo $PK_DeviceTemplate_List
}


FindDevice_Template()
{
        local PK_Device_Parent="${1//\'}" FK_DeviceTemplate="${2//\'}" NoRecursion="$3" IncludeParent="$4" All="$5"
        local Limit Found=0

        if [[ -z "$PK_Device_Parent" || -z "$FK_DeviceTemplate" ]]; then
                echo ""
                return 1
        fi

        if [[ -z "$All" ]]; then
                Limit="LIMIT 1"
        fi

        local i R Q
        if [[ "$PK_Device_Parent" == 0 ]]; then
                Q="
                        SELECT PK_Device
                        FROM Device
                        WHERE FK_Device_ControlledVia IS NULL AND FK_DeviceTemplate IN ($FK_DeviceTemplate)
                        $Limit
                "
        elif [[ -z "$IncludeParent" ]]; then
                Q="
                        SELECT PK_Device
                        FROM Device
                        WHERE FK_Device_ControlledVia='$PK_Device_Parent' AND FK_DeviceTemplate IN ($FK_DeviceTemplate)
                        $Limit
                "
        else
                Q="
                        SELECT PK_Device
                        FROM Device
                        WHERE (FK_Device_ControlledVia='$PK_Device_Parent' OR PK_Device='$PK_Device_Parent') AND FK_DeviceTemplate IN ($FK_DeviceTemplate))
                        $Limit
                "
        fi
        R="$(RunSQL "$Q")"

        if [[ -n "$R" ]]; then
                echo "$R"
        fi

        if [[ ( -z "$R" || -n "$All" ) && -z "$NoRecursion" ]]; then
                Q="SELECT PK_Device FROM Device WHERE FK_Device_ControlledVia='$PK_Device_Parent'"
                R="$(RunSQL "$Q")"
                for i in $R; do
                        if FindDevice_Template "$i" "$FK_DeviceTemplate" "" "" "$All"; then
                                if [[ -z "$All" ]]; then
                                        return 0
                                else
                                        Found=1
                                fi
                        fi
                done
        else
                return 1
        fi

        [[ "$Found" -eq 1 ]]
        return $?
}

FindDevice_Category()
{
        local PK_Device_Parent="${1//\'}" FK_DeviceCategory="${2//\'}" NoRecursion="$3" IncludeParent="$4" All="$5"
        local Limit Found=0

        if [[ -z "$PK_Device_Parent" || -z "$FK_DeviceCategory" ]]; then
                echo ""
                return 1
        fi

        if [[ -z "$All" ]]; then
                Limit="LIMIT 1"
        fi

        local i R Q
        if [[ "$PK_Device_Parent" == 0 ]]; then
                Q="
                        SELECT PK_Device
                        FROM Device
                        JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
                        WHERE FK_Device_ControlledVia IS NULL AND FK_DeviceCategory IN ($FK_DeviceCategory)
                        $Limit
                "
        elif [[ -z "$IncludeParent" ]]; then
                Q="
                        SELECT PK_Device
                        FROM Device
                        JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
                        WHERE FK_Device_ControlledVia='$PK_Device_Parent' AND FK_DeviceCategory IN ($FK_DeviceCategory)
                        $Limit
                "
        else
                Q="
                        SELECT PK_Device
                        FROM Device
                        JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
                        WHERE (FK_Device_ControlledVia='$PK_Device_Parent' OR PK_Device='$PK_Device_Parent') AND FK_DeviceCategory IN ($FK_DeviceCategory)
                        $Limit
                "
        fi
        R="$(RunSQL "$Q")"

        if [[ -n "$R" ]]; then
                echo "$R"
        fi

        if [[ ( -z "$R" || -n "$All" ) && -z "$NoRecursion" ]]; then
                Q="SELECT PK_Device FROM Device WHERE FK_Device_ControlledVia='$PK_Device_Parent'"
                R="$(RunSQL "$Q")"
                for i in $R; do
                        if FindDevice_Category "$i" "$FK_DeviceCategory" "" "" "$All"; then
                                if [[ -z "$All" ]]; then
                                        return 0
                                else
                                        Found=1
                                fi
                        fi
                done
        else
                return 1
        fi

        [[ "$Found" -eq 1 ]]
        return $?
}

# Get the device number for the parent of the given device
# Returns: number or empty string
GetDeviceParent()
{
        local PK_Device="$1"
        Q="
                SELECT FK_Device_ControlledVia
                FROM Device
                WHERE PK_Device='$PK_Device'
        "
        local R=$(RunSQL "$Q")

        if [[ "$R" == NULL ]]; then
                R=""
        fi
        echo "$R"
}

# Delete a device and make its children top level
# Does exactly the same thing as CMD_Delete_Device in General_Info_Plugin
DeleteDevice()
{
        local PK_Device="$1"
        local Q R

        # Delete embedded devices
        Q="SELECT PK_Device FROM Device where FK_Device_RouteTo=$PK_Device"
        R=$(RunSQL "$Q")
        for Device in $R; do
                DeleteDevice "$Device"
        done

        local -a Queries
        Queries=(
                "UPDATE Device SET FK_Device_ControlledVia=NULL WHERE FK_Device_ControlledVia=$PK_Device"
                "DELETE FROM Device WHERE PK_Device=$PK_Device"
                "DELETE FROM CommandGroup_Command WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Command WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_CommandGroup WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_DeviceData WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_DeviceGroup WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Device_Related WHERE FK_Device=$PK_Device OR FK_Device_Related=$PK_Device"
                "DELETE FROM Device_EntertainArea WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_HouseMode WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Orbiter WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_StartupScript WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Users WHERE FK_Device=$PK_Device"
                "DELETE FROM Package_Device WHERE FK_Device=$PK_Device"
                "DELETE FROM PaidLicense WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Device_Pipe WHERE FK_Device_From=$PK_Device OR FK_Device_To=$PK_Device"
                "DELETE FROM PaidLicense WHERE FK_Device=$PK_Device"
        )

        for Q in "${Queries[@]}"; do
                RunSQL "$Q"
        done
}

XineConfSet()
{
        local Setting="$1"
        local Value="$2"
        local XineConf="${3:-/etc/pluto/xine.conf}"

        [[ -z "$Setting" || -z "$Value" ]] && return 1

        if grep -qF "$Setting" "$XineConf"; then
                sed -i "s/^.*$Setting:.*$/$Setting:$Value/" "$XineConf"
        else
                echo "$Setting:$Value" >>"$XineConf"
        fi
}

DeviceIsDisabled()
{
        local PK_Device="$1"
        local R Q

        [[ -z "$PK_Device" ]] && return 1

        Q="SELECT COUNT(*) FROM Device WHERE PK_Device='$PK_Device' AND Disabled=0"
        R=$(RunSQL "$Q")

        if [[ -n "$R" && "$R" -eq 0 ]]; then
                return 0 # Device is disabled or does not exist at all
        else
                return 1 # Device exists and is enabled
        fi
}

FindInArray()
{
        local Value="$1" Array i
        shift
        Array=("$@")

        for ((i = 0; i < ${#Array[*]}; i++)); do
                if [[ "${Array[$i]}" == "$Value" ]]; then
                        echo "$i"
                        return 0
                fi
        done
        return 1
}

FindInArray_Prefix()
{
        local Value="$1" Array i
        shift
        Array=("$@")

        for ((i = 0; i < ${#Array[*]}; i++)); do
                if [[ "${Array[$i]}" == "$Value"* ]]; then
                        echo "$i"
                        return 0
                fi
        done
        return 1
}

# Verify that the given string is a valid IPv4
ValidIP()
{
        local IP="$1"

        local IPn="[0-9]{1,3}"
        local IPpattern="^($IPn)\\.($IPn)\\.($IPn)\\.($IPn)$"
        local i Number

        # Bash 3.1 requires $IPpattern to be quoted, otherwise it gives a syntax error
        # Bash 3.2 requires $IPpattern to be unquoted, otherwise it fails to match the pattern
        # Ubuntu has Bash 3.2
        if [[ ! "$IP" =~ $IPpattern ]]; then
                return 1
        fi

        for ((i = 1; i <= 4; i++)); do
                Number="${BASH_REMATCH[$i]}"
                if ((Number < 0 || Number > 255)); then
                        return 1
                fi
        done

        return 0
}

GetVideoDriver()
{
        if [[ -n "$ForceVESA" ]]; then
                echo vesa
                return 0
        fi

        local VideoDriver
#
#<-mkr_B_via_b->
        VideoDriver=$(lspci | grep ' VGA ' | cut -d' ' -f5)
        # If we only detect a vesa based system, lets see if we can find out what else it might be
        #if [[ "$VideoDriver" == "vesa" ]]; then
        #{
        #        DisplayNote=$(lshwd|grep "Display controller"| cut -f 2 -d \|)
                # This should work beautifully for the ASUS eee Box
        #        if [[ "$DisplayNote" == "Mobile Integrated Graphics Controller (vesa)" ]]; then
        #        {
        #                VideoDriver="intel"
        #        }
        #        fi
        #}
        #fi
        case "$VideoDriver" in
                nVidia)
                        if PackageIsInstalled nvidia-glx || PackageIsInstalled nvidia-glx-new || PackageIsInstalled nvidia-glx-71 || PackageIsInstalled nvidia-glx-96 || PackageIsInstalled nvidia-glx-173 || PackageIsInstalled nvidia-glx-180 || PackageIsInstalled nvidia-glx-190 || PackageIsInstalled nvidia-glx-195 || PackageIsInstalled nvidia-glx-260 ;then
                                VideoDriver="nvidia"
                        fi
                ;;
                Radeon|ATI) PackageIsInstalled xorg-driver-fglrx && VideoDriver="fglrx" ;;
                Intel) VideoDriver="intel" ;;
                "") VideoDriver="vesa" ;; # just-in-case default
        esac
#<-mkr_B_via_e->
        echo "$VideoDriver"
}

ReloadDevicesOnThisMachine()
{
        for Dev in $(cat /usr/pluto/locks/pluto_spawned_local_devices.txt); do
                /usr/pluto/bin/MessageSend "$DCERouter" 0 "$Dev" 7 1 163 "Utils.sh ReloadDevicesOnThisMachine"
        done
}

OpenGLeffects()
{
        local Q

        Q="
                SELECT IK_DeviceData
                FROM Device
                LEFT JOIN Device AS Parent ON Parent.PK_Device=Device.FK_Device_ControlledVia
                JOIN Device_DeviceData ON Device.PK_Device=FK_Device
                WHERE
                        Device.FK_DeviceTemplate='$DEVICETEMPLATE_OnScreen_Orbiter'
                        AND (
                                Device.FK_Device_ControlledVia='$PK_Device'
                                OR Parent.FK_Device_ControlledVia='$PK_Device'
                        )
                AND FK_DeviceData='$DEVICEDATA_Use_OpenGL_effects'
        "
        RunSQL "$Q"
}

AlphaBlendingEnabled()
{
        local Q

        Q="
                SELECT IK_DeviceData
                FROM Device
                LEFT JOIN Device AS Parent ON Parent.PK_Device=Device.FK_Device_ControlledVia
                JOIN Device_DeviceData ON Device.PK_Device=FK_Device
                WHERE
                        Device.FK_DeviceTemplate='$DEVICETEMPLATE_OnScreen_Orbiter'
                        AND (
                                Device.FK_Device_ControlledVia='$PK_Device'
                                OR Parent.FK_Device_ControlledVia='$PK_Device'
                        )
                AND FK_DeviceData='$DEVICEDATA_Use_alpha_blended_UI'
        "
        RunSQL "$Q"
}

GetDeviceData()
{
        local Q
        local Device="$1" DeviceData="$2"

        Q="
                SELECT IK_DeviceData
                FROM Device_DeviceData
                WHERE FK_Device='$Device' AND FK_DeviceData='$DeviceData'
        "
        Field 1 "$(RunSQL "$Q")"
}

SetDeviceData()
{
        local Q
        local Device="$1" DeviceData="$2" Value="$3"

        Q="
                UPDATE Device_DeviceData
                SET IK_DeviceData='$Value'
                WHERE FK_Device=$Device AND FK_DeviceData=$DeviceData
        "
        RunSQL "$Q"
}

UI_SetOptions()
{
        local OrbiterDev="$1"
        local OpenGLeffects="$2"
        local AlphaBlending="$3"
        local UI_Version="$4"

        # disable OpenGL effects
        Q="
                REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
                VALUES('$OrbiterDev', '$DEVICEDATA_Use_OpenGL_effects', '$OpenGLeffects')
        "
        RunSQL "$Q"
        # disable alpha blending
        Q="
                REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
                VALUES('$OrbiterDev', '$DEVICEDATA_Use_alpha_blended_UI', '$AlphaBlending')
        "
        RunSQL "$Q"
        # select UI
        Q="
                REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
                VALUES('$OrbiterDev', '$DEVICEDATA_PK_UI', '$UI_Version')
        "
        RunSQL "$Q"
}

function GeneratePassword() {
        #TODO: Replace with this --->  </dev/urandom tr -dc A-Za-z0-9_ | head -c8
        local -a alpha1=(Q W E R T Y U I O P A S D F G H J K L Z X C V B N M)
        local -a alpha2=(q w e r t y u i o p a s d f g h j k l z x c v b n m)
        local -a alpha3=(1 2 3 4 5 6 7 8 9 0)

        local pass=""
        pass=$pass"${alpha1[$(($RANDOM%26))]}${alpha1[$(($RANDOM%26))]}${alpha1[$(($RANDOM%26))]}"
        pass=$pass"${alpha2[$(($RANDOM%26))]}${alpha2[$(($RANDOM%26))]}${alpha2[$(($RANDOM%26))]}"
        pass=$pass"${alpha3[$(($RANDOM%10))]}${alpha3[$(($RANDOM%10))]}"

        local fromwhere=$(( $RANDOM % 3 + 1 ))
        [[ $fromwhere == 1 ]] && pass=$pass"${alpha1[$(($RANDOM%26))]}"
        [[ $fromwhere == 2 ]] && pass=$pass"${alpha2[$(($RANDOM%26))]}"
        [[ $fromwhere == 3 ]] && pass=$pass"${alpha3[$(($RANDOM%10))]}"


        for i in `seq 1 100` ;do
                local split=$(( $RANDOM % ${#pass} + 1 ))
                pass1=${pass:$split}
                pass2=${pass:0:$split}
                pass="${pass1}${pass2}"
        done

        echo $pass
}

function GeneratePasswordOf6Digits()
{
        local pass
        for ((i = 0; i < 6; i++)); do
                pass="${pass}$((RANDOM % 10))"
        done
        echo "$pass"
}

Log()
{
        local File="$1"; shift
        local Msg="$*"

        echo "LOG: $Msg"
        echo "$Msg" >>"$File"
}


function BlacklistConfFiles()
{
        local file=$1

        if [[ -e /etc/confblacklist ]] ;then
                while read line; do
                        if [[ "$line" == "$file" ]] ;then
                                return 0
                        fi
                done < /etc/confblacklist
        fi

        return 1
}

function VDRInstalled() {
        # Return true if VDR is installed
        DEVICETEMPLATE_VDR_Plugin="1704"
        Q="SELECT PK_Device FROM Device Where FK_DeviceTemplate = $DEVICETEMPLATE_VDR_Plugin"
        VDRDevice=$(RunSQL "$Q")                                         
        if [ "$VDRDevice" == "" ] ; then                                 
                RETURNVALUE=1                                             
        else                                                             
                RETURNVALUE=0                                             
        fi                                                               
        return $RETURNVALUE
}

Boot a new MD with either Intel or ATI.
Medium overlay at best please.

Please report results.
Thank you as always.
I never quit... I just ping out.

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #1 on: November 22, 2011, 03:57:33 am »
I have decent playback on my crap ATI cards for video... not as clean as nVidia of course... but not much tearing and no skipping or jittering, audio is synced and all that jazz. No odd pausing.
What I am using (ie crap laying around):
Radeon X1200 (acer nettop)
Radeon X700
Intel 945GM
Intel 82845G (all hail the mighty optiplex 260)

Core is 810... probably better results on 1004 (at least on intel).
I do recommend you turn off the screen saver for punk ati cards.

Intel avwizard fine and playback is fine... but I can only run ui1. Crashes after LinuxMCE loading messages (the big ones), drops to login. If anyone has a working UI2 Intel setup, I would really appreciate an output of cat /etc/X11/xorg.conf

My ATI has trouble with Myth. Will explore. Intel works fine with myth. ATI is at 1080p, Intel is at 12XX whatever by 800, labeled custom.
« Last Edit: November 22, 2011, 08:22:06 am by l3mce »
I never quit... I just ping out.

Roman

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #2 on: November 23, 2011, 10:12:49 pm »
On my Dell D600 with an Radeon 9000 it did not work.
AV Wizard did not come up.
best regards
Roman

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #3 on: November 24, 2011, 10:08:42 am »
Thank you very much. Can you please ssh into that machine and post the output of:
Code: [Select]
lspci | grep ' VGA 'and
Code: [Select]
/etc/X11/xorg.conf
To ssh into the moon units:
Code: [Select]
ssh user@192.168.80.1
password
ssh moonXX

Where user is your user name, password is your password, and XX is your moon number.
Thanks again.
« Last Edit: November 24, 2011, 10:17:21 am by l3mce »
I never quit... I just ping out.

Roman

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #4 on: November 24, 2011, 11:03:32 pm »
Hi!
Here we go

lspci | grep VGA
01:00.0 VGA compatible controller: ATI Technologies Inc Radeon RV250 [Mobility FireGL 9000] (rev 01)



more /etc/X11/xorg.conf

Section "Screen"
        Identifier      "Default Screen"
        DefaultDepth    24
EndSection

Section "Module"
        Load    "glx"
        Disable "dri2"
EndSection

Section "Device"
        Identifier      "Default Device"
        Driver  "fglrx"
EndSection

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #5 on: November 25, 2011, 12:05:47 am »
Ok... then autodetection did work... however that card is not supported by the fglrx driver.

Guess I need to get an updated list of supported cards and update the logic.

Before you do anything else... can you please give me the output of:
Code: [Select]
aticonfig
Then ssh in and paste the following.

Code: [Select]
sed -i ‘s/fglrx/radeon/’ /etc/X11/xorg.confand reboot. If it still fails at X;
Code: [Select]
apt-get install xserver-xorg-video-ati
Please report back whether or not you had to install the package. I am frankly unsure, but it will be helpful to know for my detection efforts. Thank you.

*On further review I see that you MAY actually have to purge that fglrx driver. Directions here IF you have problems.
https://wiki.ubuntu.com/X/Troubleshooting/FglrxInteferesWithRadeonDriver#Problem:%20%20Need%20to%20fully%20remove%20-fglrx%20and%20reinstall%20-ati%20from%20scratch

*Now that I think about it... I think it might STILL overwrite these changes on reboot. I believe Utils is run on boot, and it may incorrectly try and "fix" it. If indeed this happens (you can check by looking at your xorg again after your changes)... I will have you a solution very shortly... but I would appreciate it if you would tell me for sure one way or the other. I am writing this stuff blind... I don't have hardware that this doesn't work for. I have sold or given away all of my ATI stuff in an effort to horde nVidia stuff.

I appreciate your going through these steps. They will help a lot of people in the long run. I have already figured out a better way to test ATI cards for compatability because of this, and may have figured out a way to do compositing by accident that I didn't previously think was possible without a lot of work.


« Last Edit: November 25, 2011, 06:05:35 am by l3mce »
I never quit... I just ping out.

Roman

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #6 on: November 25, 2011, 05:09:28 pm »
I hope I did understand you correctly with the "aticonfig".
I get an output but this command is not enough to show anything.
The whole output of "aticonfig" I put in a txtfile attached to this post.

After ssh into the moon and to set the command "sed -i ‘s/fglrx/radeon/’ /etc/X11/xorg.conf" i rebooted the moon. Again Failed to setup X

Then I SSH again into the moon and with "apt-get install xserver-xorg-video-ati" I get the message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
xserver-xorg-video-ati is already the newest version.
xserver-xorg-video-ati set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Roman

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #7 on: November 25, 2011, 05:18:01 pm »
I followed your link and just perhaps the following information is useful for you

dpkg -l '*fglrx*'

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                        Version                     Description
+++-===========================-===========================-======================================================================
ii  fglrx-amdcccle              2:8.543-0ubuntu4.1          Catalyst Control Center for the ATI graphics accelerators
un  fglrx-control               <none>                      (no description available)
un  fglrx-control-qt2           <none>                      (no description available)
un  fglrx-driver                <none>                      (no description available)
ii  fglrx-kernel-source         2:8.543-0ubuntu4.1          Kernel module source for the ATI graphics accelerators
ii  fglrx-modaliases            2:8.543-0ubuntu4.1          Identifiers supported by the ATI graphics driver
un  xfree86-driver-fglrx        <none>                      (no description available)
ii  xorg-driver-fglrx           2:8.543-0ubuntu4.1          Video driver for the ATI graphics accelerators

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #8 on: November 25, 2011, 05:22:10 pm »
OK. I will give you some new code in a minute that will fix it.

Thank you for your patience.
I never quit... I just ping out.

Roman

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #9 on: November 25, 2011, 05:40:44 pm »
no STOP!!! :-) :-)
It seems that there is no need for new code

I followed the link you gave to me https://wiki.ubuntu.com/X/Troubleshooting/FglrxInteferesWithRadeonDriver#Problem:%20 Need to fully remove -fglrx and reinstall -ati from scratch

I did
 dpkg -l '*fglrx*'

then
  sudo apt-get remove --purge xorg-driver-fglrx fglrx*
  sudo apt-get install --reinstall libgl1-mesa-glx libgl1-mesa-dri fglrx-modaliases
  sudo dpkg-reconfigure xserver-xorg

then
   sudo apt-get install --reinstall xserver-xorg-core

and then I rebooted the Moon.

Guess what? ;-)
The AVWizard started!!!!
I am just in the section of finishing the "Sarah Wizard".
I update you in a minute if this was a reliable method
 
Here you  find the screendump during tthee sps above mentioned.

sudo apt-get remove --purge xorg-driver-fglrx fglrx*                                                             
Reading package lists... Done                                                                                                     
Building dependency tree                                                                                                         
Reading state information... Done                                                                                                 
Note, selecting fglrx-driver-dev for regex 'fglrx*'                                                                               
Note, selecting fglrx-driver for regex 'fglrx*'                                                                                   
Note, selecting xfree86-driver-fglrx-dev for regex 'fglrx*'                                                                       
Note, selecting fglrx-control for regex 'fglrx*'                                                                                 
Note, selecting fglrx-amdcccle for regex 'fglrx*'                                                                                 
Note, selecting fglrx-modaliases for regex 'fglrx*'                                                                               
Note, selecting fglrx-kernel-source for regex 'fglrx*'                                                                           
Note, selecting xorg-driver-fglrx for regex 'fglrx*'                                                                             
Note, selecting fglrx-control-qt2 for regex 'fglrx*'                                                                             
Note, selecting xorg-driver-fglrx-dev for regex 'fglrx*'                                                                         
Note, selecting xfree86-driver-fglrx for regex 'fglrx*'                                                                           
The following packages were automatically installed and are no longer required:                                                   
  fakeroot dkms                                                                                                                   
Use 'apt-get autoremove' to remove them.                                                                                         
The following packages will be REMOVED:                                                                                           
  envyng-core* fglrx-amdcccle* fglrx-kernel-source* fglrx-modaliases* xorg-driver-fglrx*                                         
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.                                                                   
After this operation, 56.2MB disk space will be freed.                                                                           
Do you want to continue [Y/n]? y                                                                                                 
(Reading database ... 105485 files and directories currently installed.)                                                         
Removing envyng-core ...                                                                                                         
dpkg - warning: while removing envyng-core, directory `/usr/share/icons/hicolor/128x128/apps/envyng.png' not empty so not removed.
dpkg - warning: while removing envyng-core, directory `/usr/share/icons/hicolor/64x64/apps/envyng.png' not empty so not removed. 
dpkg - warning: while removing envyng-core, directory `/usr/share/icons/hicolor/32x32/apps/envyng.png' not empty so not removed. 
dpkg - warning: while removing envyng-core, directory `/usr/share/icons/hicolor/22x22/apps/envyng.png' not empty so not removed. 
dpkg - warning: while removing envyng-core, directory `/usr/share/icons/hicolor/16x16/apps/envyng.png' not empty so not removed. 
dpkg - warning: while removing envyng-core, directory `/usr/share/envy/pixmaps' not empty so not removed.                         
dpkg - warning: while removing envyng-core, directory `/usr/share/envy' not empty so not removed.                                 
Removing fglrx-amdcccle ...                                                                                                       
Removing xorg-driver-fglrx ...                                                                                                   
Purging configuration files for xorg-driver-fglrx ...                                                                             
dpkg - warning: while removing xorg-driver-fglrx, directory `/etc/ati' not empty so not removed.                                 
Removing fglrx-kernel-source ...                                                                                                 
Removing all DKMS Modules                                                                                                         
Done.                                                                                                                             
Removing fglrx-modaliases ...                                                                                                     
Processing triggers for libc6 ...                                                                                                 
ldconfig deferred processing now taking place                                                                                     
root@moon56:~#                                                                                                                   
root@moon56:~#                                                                                                                   
root@moon56:~# apt-get install --reinstall libgl1-mesa-glx libgl1-mesa-dri fglrx-modaliases                               
Reading package lists... Done                                                                                             
Building dependency tree                                                                                                   
Reading state information... Done                                                                                         
The following packages were automatically installed and are no longer required:                                           
  fakeroot dkms                                                                                                           
Use 'apt-get autoremove' to remove them.                                                                                   
The following NEW packages will be installed:                                                                             
  fglrx-modaliases                                                                                                         
0 upgraded, 1 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
Need to get 2786kB/2797kB of archives.
After this operation, 73.7kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
  libgl1-mesa-glx libgl1-mesa-dri fglrx-modaliases
Authentication warning overridden.
Get:1 http://old-releases.ubuntu.com intrepid/main libgl1-mesa-glx 7.2-1ubuntu2 [114kB]
Get:2 http://old-releases.ubuntu.com intrepid/main libgl1-mesa-dri 7.2-1ubuntu2 [2672kB]
Fetched 2786kB in 6s (422kB/s)
(Reading database ... 105245 files and directories currently installed.)
Preparing to replace libgl1-mesa-glx 7.2-1ubuntu2 (using .../libgl1-mesa-glx_7.2-1ubuntu2_i386.deb) ...
Unpacking replacement libgl1-mesa-glx ...
Preparing to replace libgl1-mesa-dri 7.2-1ubuntu2 (using .../libgl1-mesa-dri_7.2-1ubuntu2_i386.deb) ...
Unpacking replacement libgl1-mesa-dri ...
Selecting previously deselected package fglrx-modaliases.
Unpacking fglrx-modaliases (from .../fglrx-modaliases_2%3a8.543-0ubuntu4.1_i386.deb) ...
Setting up libgl1-mesa-glx (7.2-1ubuntu2) ...

Setting up libgl1-mesa-dri (7.2-1ubuntu2) ...
Setting up fglrx-modaliases (2:8.543-0ubuntu4.1) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
root@moon56:~#
root@moon56:~#  sudo dpkg-reconfigure xserver-xorg
xserver-xorg postinst warning: overwriting possibly-customised configuration
   file; backup in /etc/X11/xorg.conf.20111125171658
root@moon56:~# reboot



Roman

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #10 on: November 25, 2011, 05:43:42 pm »
One funny effect is left.
I set the AVWizard to 1024x768 and the picture on the screen is 3/4 of the Display beginning top left corner. So I have a black area at the bottom and the right side.
I do not think that this old display can do more than 1024x768...

Roman

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #11 on: November 25, 2011, 06:13:59 pm »
I post the current xorg.conf

                                                                         
# xorg.conf (X.Org X Window System server configuration file)                                                   
#                                                                                                               
# This file was generated by dexconf, the Debian X Configuration tool, using                                     
# values from the debconf database.                                                                             
#                                                                                                               
# Edit this file with caution, and see the xorg.conf manual page.                                               
# (Type "man xorg.conf" at the shell prompt.)                                                                   
#                                                                                                               
# This file is automatically updated on xserver-xorg package upgrades *only*                                     
# if it has not been modified since the last upgrade of the xserver-xorg                                         
# package.                                                                                                       
#                                                                                                               
# Note that some configuration settings that could be done previously                                           
# in this file, now are automatically configured by the server and settings                                     
# here are ignored.                                                                                             
#                                                                                                               
# If you have edited this file but would like it to be automatically updated                                     
# again, run the following command:                                                                             
#   sudo dpkg-reconfigure -phigh xserver-xorg                                                                   

Section "Device"
        Identifier      "Configured Video Device"
        Option          "UseFBDev"              "true"
        Option "XvmcUsesTextures" "true"             
        Option "renderAccel" "true"                   
        Option "NoDDCValue"                           
        Option "UseEDID" "true"                       
        Option "ExactModeTimingsDVI" "true"           
        Option "NoLogo" "true"                       
        Option "NoBandWidthTest" "true"               
        Option "ModeValidation" "NoDFPNativeResolutionCheck, NoEdidMaxPClkCheck, NoMaxPClkCheck, AllowInterlacedModes, AllowNon60HzD
FPModes, NoEdidModes"                                                                                                               
        Option "DynamicTwinView" "false"
        Option "UseEvents" "true"
        Option          "ConnectedMonitor" "CRT"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
        Modeline        "1024x768"      51.85  1024 1056 1248 1280    768  784  791  807
        HorizSync       20-500
        VertRefresh     49-51
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
        Option "XvmcUsesTextures" "true"
        Option "renderAccel" "true"
        Option "NoDDCValue"
        Option "UseEDID" "true"
        Option "ExactModeTimingsDVI" "true"
        Option "NoLogo" "true"
        Option "NoBandWidthTest" "true"
        Option "ModeValidation" "NoDFPNativeResolutionCheck, NoEdidMaxPClkCheck, NoMaxPClkCheck, AllowInterlacedModes, AllowNon60HzD
FPModes, NoEdidModes"
        Option "DynamicTwinView" "false"
        Option "UseEvents" "true"
        Option  "TVStandard"    "1024x768"
EndSection
Section "Extensions"
        Option "Composite" "false"
        Option "RENDER" "true"
EndSection

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #12 on: November 25, 2011, 06:55:33 pm »
You are using native linux vesa drivers. That is why the display is funky.

I would appreciate it if you would backup your xorg:
(as root)
Code: [Select]
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.vesa
then
Code: [Select]
echo > /etc/X11/xorg.conf
then you can try copying the following into xorg.conf with whatever editor you like. I really need to do a little bit of work to make sure this is correct... you can give it a try... but I need about 30 minutes more to get it absolutely correct... but it might work.
Code: [Select]
# xorg.conf (X.Org X Window System server configuration file)                                                   
#                                                                                                               
# This file was generated by dexconf, the Debian X Configuration tool, using                                     
# values from the debconf database.                                                                             
#                                                                                                               
# Edit this file with caution, and see the xorg.conf manual page.                                               
# (Type "man xorg.conf" at the shell prompt.)                                                                   
#                                                                                                               
# This file is automatically updated on xserver-xorg package upgrades *only*                                     
# if it has not been modified since the last upgrade of the xserver-xorg                                         
# package.                                                                                                       
#                                                                                                               
# Note that some configuration settings that could be done previously                                           
# in this file, now are automatically configured by the server and settings                                     
# here are ignored.                                                                                             
#                                                                                                               
# If you have edited this file but would like it to be automatically updated                                     
# again, run the following command:                                                                             
#   sudo dpkg-reconfigure -phigh xserver-xorg                                                                   

Section "Device"
        Identifier      "Configured Video Device"
        Option          "UseFBDev"              "true"
        Option "XvmcUsesTextures" "true"             
        Option "renderAccel" "true"                   
        Option "NoDDCValue"                           
        Option "UseEDID" "true"                       
        Option "ExactModeTimingsDVI" "true"           
        Option "NoLogo" "true"                       
        Option "NoBandWidthTest" "true"               
        Option "ModeValidation" "NoDFPNativeResolutionCheck, NoEdidMaxPClkCheck, NoMaxPClkCheck, AllowInterlacedModes, AllowNon60HzD
FPModes, NoEdidModes"                                                                                                               
        Option "DynamicTwinView" "false"
        Option "UseEvents" "true"
        Option          "ConnectedMonitor" "CRT"
EndSection

Section "Monitor"
        Identifier      "Configured Monitor"
        Modeline        "1024x768"      51.85  1024 1056 1248 1280    768  784  791  807
        HorizSync       20-500
        VertRefresh     49-51
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Monitor         "Configured Monitor"
        Device          "Configured Video Device"
        Option "XvmcUsesTextures" "true"
        Option "renderAccel" "true"
        Option "NoDDCValue"
        Option "UseEDID" "true"
        Option "ExactModeTimingsDVI" "true"
        Option "NoLogo" "true"
        Option "NoBandWidthTest" "true"
        Option "ModeValidation" "NoDFPNativeResolutionCheck, NoEdidMaxPClkCheck, NoMaxPClkCheck, AllowInterlacedModes, AllowNon60HzD
FPModes, NoEdidModes"
        Option "DynamicTwinView" "false"
        Option "UseEvents" "true"
        Option  "TVStandard"    "1024x768"
EndSection
Section "Screen"
        Identifier      "Default Screen"
        DefaultDepth    24
EndSection

Section "Module"
        Load    "glx"
        Disable "dri2"
EndSection

Section "Device"
        Identifier      "Default Device"
        Driver  "radeon"
EndSection

Section "Extensions"
        Option "Composite" "false"
        Option "RENDER" "true"
EndSection

Here is a new Utils.sh.
*NOTE THIS Utils.sh is for THIS specific user as a stop gap. It will probably NOT affect anyone else's issues without additional work. This is for TESTING purposes only*
Code: [Select]
#!/bin/bash

if [[ -n "$HEADER_Utils" ]]; then
        return 0
fi
HEADER_Utils=included

. /usr/pluto/bin/SQL_Ops.sh
. /usr/pluto/bin/Config_Ops.sh

DEVICETEMPLATE_OnScreen_Orbiter=62
DEVICEDATA_Use_OpenGL_effects=172
DEVICEDATA_Use_alpha_blended_UI=169
DEVICEDATA_PK_UI=104

function AddBookmark {
        return 0
        Url="$1"
        Name="$2"

        [[ ! -f /home/public/bookmarks.html ]] || return 0

        # Generate an id for this bookmark
        ID=$(echo "$Url" | sha1sum)
        ID='rdf:#$'${ID:0:6}

        # Generate the bookmark entry
        Bookmark='   <DT><A HREF="'$Url'" ADD_DATE="1126869382" LAST_MODIFIED="1126869442" ID="'$ID'">'$Name'</A>'
        Bookmark=$(echo $Bookmark | sed 's/"/\\\"/g')

        for BookmarksFile in /home/public/bookmarks.html /home/user_*/bookmarks.html ;do
                # See if the bookmark is already there
                if grep -q "ID=\"$ID\"" $BookmarksFile ;then
                        continue
                fi

                # Add the bookmark string to the file
                awk '
                        BEGIN { HR=0 }
                        HR==0 && /<HR>/ {print "'"$Bookmark"'"; HR=1}
                        {print}
                ' $BookmarksFile > $BookmarksFile.$$
                mv $BookmarksFile.$$ $BookmarksFile
        done

}

function DelBookmark {
        return 0
        Url="$1"
        Name="$2"

        [[ ! -f /home/public/bookmarks.html ]] || return 0

        # Generate an id for this bookmark
        ID=$(echo "$Url" | sha1sum)
        ID='rdf:#$'${ID:0:6}

        for BookmarksFile in /home/public/bookmarks.html /home/user_*/bookmarks.html ;do
                grep -v "ID=\"$ID\"" $BookmarksFile >> $BookmarksFile.$$
                mv $BookmarksFile.$$ $BookmarksFile
        done
}

TranslateSerialPort()
{
        local SearchFor="$1"
        local PCI USB

        SerialPort=
        if [[ "$SearchFor" == pci* ]]; then
                if [[ -d /sys/class/tty ]]; then
                        pushd /sys/class/tty &>/dev/null
                        for dev in ttyUSB*/device ttyACM*/device; do
                                id=$(readlink -f "$dev" | sed -r 's,^.*(pci.*)/usb[0-9]*/[0-9./-]*/[0-9]*-([0-9.]*):[0-9.]*(/ttyUSB[0-9]*)?$,\1+\2,g')
                                if [[ "$id" == "$SearchFor" ]]; then
                                        SerialPort="/dev/$(dirname "$dev")"
                                        break;
                                fi
                        done
                        popd &>/dev/null
                fi
        else
                SerialPort="$SearchFor"
        fi

        builtin echo "$SerialPort"
}

TranslateSoundCard()
{
        local SoundCard="$1" AlsaCard=
        local PCI USB
        local Cards Card Dev

        if [[ -d /sys/class/sound && "$SoundCard" == pci* ]]; then
                if [[ "$SoundCard" == *+* ]]; then
                        PCI="${SoundCard%+*}"
                        USB="${SoundCard#*+}"
                else
                        PCI="${SoundCard}"
                        USB=
                fi
                pushd /sys/class/sound &>/dev/null
                Cards=$(find -name 'controlC*')
                for Card in $Cards; do
                        Card="${Card#./}"
                        Dev=$(readlink "$Card/device"|cut -f3 -d/)
                        if [[ -n "$USB" ]]; then
                                if [[ "$Dev" == *"$PCI"*usb*"$USB:"* ]]; then
                                        AlsaCard="${Card#controlC}"
                                        break
                                fi
                        else
                                if [[ "$PCI" == *"$Dev" ]]; then
                                        AlsaCard="${Card#controlC}"
                                        break
                                fi
                        fi
                done
                popd &>/dev/null
        fi

        builtin echo "$AlsaCard"
}

UseAlternativeLibs()
{
        export LD_LIBRARY_PATH=/opt/libsdl/lib:/opt/libxine/lib:/opt/libsdl1.2-1.2.7+1.2.8cvs20041007/lib:/opt/linphone-1.3.5/lib
}

function ListTemplates_Category {
        local FK_DeviceCategory_Parent="$1"
        local PK_DeviceTemplate_List=""
        local PK_DeviceCategory=""
        local PK_DeviceTemplate=""

        R=$(RunSQL "SELECT PK_DeviceCategory FROM DeviceCategory WHERE FK_DeviceCategory_Parent = $FK_DeviceCategory_Parent")
        for PK_DeviceCategory in $R ;do
                PK_DeviceTemplate_List="$PK_DeviceTemplate_List $(ListTemplates_Category "$PK_DeviceCategory")"
        done

        R=$(RunSQL "SELECT PK_DeviceTemplate FROM DeviceTemplate WHERE FK_DeviceCategory=$FK_DeviceCategory_Parent")
        for PK_DeviceTemplate in $R ;do
                PK_DeviceTemplate_List="$PK_DeviceTemplate_List $PK_DeviceTemplate"
        done

        echo $PK_DeviceTemplate_List
}


FindDevice_Template()
{
        local PK_Device_Parent="${1//\'}" FK_DeviceTemplate="${2//\'}" NoRecursion="$3" IncludeParent="$4" All="$5"
        local Limit Found=0

        if [[ -z "$PK_Device_Parent" || -z "$FK_DeviceTemplate" ]]; then
                echo ""
                return 1
        fi

        if [[ -z "$All" ]]; then
                Limit="LIMIT 1"
        fi

        local i R Q
        if [[ "$PK_Device_Parent" == 0 ]]; then
                Q="
                        SELECT PK_Device
                        FROM Device
                        WHERE FK_Device_ControlledVia IS NULL AND FK_DeviceTemplate IN ($FK_DeviceTemplate)
                        $Limit
                "
        elif [[ -z "$IncludeParent" ]]; then
                Q="
                        SELECT PK_Device
                        FROM Device
                        WHERE FK_Device_ControlledVia='$PK_Device_Parent' AND FK_DeviceTemplate IN ($FK_DeviceTemplate)
                        $Limit
                "
        else
                Q="
                        SELECT PK_Device
                        FROM Device
                        WHERE (FK_Device_ControlledVia='$PK_Device_Parent' OR PK_Device='$PK_Device_Parent') AND FK_DeviceTemplate IN ($FK_DeviceTemplate))
                        $Limit
                "
        fi
        R="$(RunSQL "$Q")"

        if [[ -n "$R" ]]; then
                echo "$R"
        fi

        if [[ ( -z "$R" || -n "$All" ) && -z "$NoRecursion" ]]; then
                Q="SELECT PK_Device FROM Device WHERE FK_Device_ControlledVia='$PK_Device_Parent'"
                R="$(RunSQL "$Q")"
                for i in $R; do
                        if FindDevice_Template "$i" "$FK_DeviceTemplate" "" "" "$All"; then
                                if [[ -z "$All" ]]; then
                                        return 0
                                else
                                        Found=1
                                fi
                        fi
                done
        else
                return 1
        fi

        [[ "$Found" -eq 1 ]]
        return $?
}

FindDevice_Category()
{
        local PK_Device_Parent="${1//\'}" FK_DeviceCategory="${2//\'}" NoRecursion="$3" IncludeParent="$4" All="$5"
        local Limit Found=0

        if [[ -z "$PK_Device_Parent" || -z "$FK_DeviceCategory" ]]; then
                echo ""
                return 1
        fi

        if [[ -z "$All" ]]; then
                Limit="LIMIT 1"
        fi

        local i R Q
        if [[ "$PK_Device_Parent" == 0 ]]; then
                Q="
                        SELECT PK_Device
                        FROM Device
                        JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
                        WHERE FK_Device_ControlledVia IS NULL AND FK_DeviceCategory IN ($FK_DeviceCategory)
                        $Limit
                "
        elif [[ -z "$IncludeParent" ]]; then
                Q="
                        SELECT PK_Device
                        FROM Device
                        JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
                        WHERE FK_Device_ControlledVia='$PK_Device_Parent' AND FK_DeviceCategory IN ($FK_DeviceCategory)
                        $Limit
                "
        else
                Q="
                        SELECT PK_Device
                        FROM Device
                        JOIN DeviceTemplate ON FK_DeviceTemplate=PK_DeviceTemplate
                        WHERE (FK_Device_ControlledVia='$PK_Device_Parent' OR PK_Device='$PK_Device_Parent') AND FK_DeviceCategory IN ($FK_DeviceCategory)
                        $Limit
                "
        fi
        R="$(RunSQL "$Q")"

        if [[ -n "$R" ]]; then
                echo "$R"
        fi

        if [[ ( -z "$R" || -n "$All" ) && -z "$NoRecursion" ]]; then
                Q="SELECT PK_Device FROM Device WHERE FK_Device_ControlledVia='$PK_Device_Parent'"
                R="$(RunSQL "$Q")"
                for i in $R; do
                        if FindDevice_Category "$i" "$FK_DeviceCategory" "" "" "$All"; then
                                if [[ -z "$All" ]]; then
                                        return 0
                                else
                                        Found=1
                                fi
                        fi
                done
        else
                return 1
        fi

        [[ "$Found" -eq 1 ]]
        return $?
}

# Get the device number for the parent of the given device
# Returns: number or empty string
GetDeviceParent()
{
        local PK_Device="$1"
        Q="
                SELECT FK_Device_ControlledVia
                FROM Device
                WHERE PK_Device='$PK_Device'
        "
        local R=$(RunSQL "$Q")

        if [[ "$R" == NULL ]]; then
                R=""
        fi
        echo "$R"
}

# Delete a device and make its children top level
# Does exactly the same thing as CMD_Delete_Device in General_Info_Plugin
DeleteDevice()
{
        local PK_Device="$1"
        local Q R

        # Delete embedded devices
        Q="SELECT PK_Device FROM Device where FK_Device_RouteTo=$PK_Device"
        R=$(RunSQL "$Q")
        for Device in $R; do
                DeleteDevice "$Device"
        done

        local -a Queries
        Queries=(
                "UPDATE Device SET FK_Device_ControlledVia=NULL WHERE FK_Device_ControlledVia=$PK_Device"
                "DELETE FROM Device WHERE PK_Device=$PK_Device"
                "DELETE FROM CommandGroup_Command WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Command WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_CommandGroup WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_DeviceData WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_DeviceGroup WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Device_Related WHERE FK_Device=$PK_Device OR FK_Device_Related=$PK_Device"
                "DELETE FROM Device_EntertainArea WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_HouseMode WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Orbiter WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_StartupScript WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Users WHERE FK_Device=$PK_Device"
                "DELETE FROM Package_Device WHERE FK_Device=$PK_Device"
                "DELETE FROM PaidLicense WHERE FK_Device=$PK_Device"
                "DELETE FROM Device_Device_Pipe WHERE FK_Device_From=$PK_Device OR FK_Device_To=$PK_Device"
                "DELETE FROM PaidLicense WHERE FK_Device=$PK_Device"
        )

        for Q in "${Queries[@]}"; do
                RunSQL "$Q"
        done
}

XineConfSet()
{
        local Setting="$1"
        local Value="$2"
        local XineConf="${3:-/etc/pluto/xine.conf}"

        [[ -z "$Setting" || -z "$Value" ]] && return 1

        if grep -qF "$Setting" "$XineConf"; then
                sed -i "s/^.*$Setting:.*$/$Setting:$Value/" "$XineConf"
        else
                echo "$Setting:$Value" >>"$XineConf"
        fi
}

DeviceIsDisabled()
{
        local PK_Device="$1"
        local R Q

        [[ -z "$PK_Device" ]] && return 1

        Q="SELECT COUNT(*) FROM Device WHERE PK_Device='$PK_Device' AND Disabled=0"
        R=$(RunSQL "$Q")

        if [[ -n "$R" && "$R" -eq 0 ]]; then
                return 0 # Device is disabled or does not exist at all
        else
                return 1 # Device exists and is enabled
        fi
}

FindInArray()
{
        local Value="$1" Array i
        shift
        Array=("$@")

        for ((i = 0; i < ${#Array[*]}; i++)); do
                if [[ "${Array[$i]}" == "$Value" ]]; then
                        echo "$i"
                        return 0
                fi
        done
        return 1
}

FindInArray_Prefix()
{
        local Value="$1" Array i
        shift
        Array=("$@")

        for ((i = 0; i < ${#Array[*]}; i++)); do
                if [[ "${Array[$i]}" == "$Value"* ]]; then
                        echo "$i"
                        return 0
                fi
        done
        return 1
}

# Verify that the given string is a valid IPv4
ValidIP()
{
        local IP="$1"

        local IPn="[0-9]{1,3}"
        local IPpattern="^($IPn)\\.($IPn)\\.($IPn)\\.($IPn)$"
        local i Number

        # Bash 3.1 requires $IPpattern to be quoted, otherwise it gives a syntax error
        # Bash 3.2 requires $IPpattern to be unquoted, otherwise it fails to match the pattern
        # Ubuntu has Bash 3.2
        if [[ ! "$IP" =~ $IPpattern ]]; then
                return 1
        fi

        for ((i = 1; i <= 4; i++)); do
                Number="${BASH_REMATCH[$i]}"
                if ((Number < 0 || Number > 255)); then
                        return 1
                fi
        done

        return 0
}

GetVideoDriver()
{
        if [[ -n "$ForceVESA" ]]; then
                echo vesa
                return 0
        fi

        local VideoDriver
#
#<-mkr_B_via_b->
        VideoDriver=$(lspci | grep ' VGA ' | cut -d' ' -f5)
        # If we only detect a vesa based system, lets see if we can find out what else it might be
        #if [[ "$VideoDriver" == "vesa" ]]; then
        #{
        #        DisplayNote=$(lshwd|grep "Display controller"| cut -f 2 -d \|)
                # This should work beautifully for the ASUS eee Box
        #        if [[ "$DisplayNote" == "Mobile Integrated Graphics Controller (vesa)" ]]; then
        #        {
        #                VideoDriver="intel"
        #        }
        #        fi
        #}
        #fi
        case "$VideoDriver" in
                nVidia)
                        if PackageIsInstalled nvidia-glx || PackageIsInstalled nvidia-glx-new || PackageIsInstalled nvidia-glx-71 || PackageIsInstalled nvidia-glx-96 || PackageIsInstalled nvidia-glx-173 || PackageIsInstalled nvidia-glx-180 || PackageIsInstalled nvidia-glx-190 || PackageIsInstalled nvidia-glx-195 || PackageIsInstalled nvidia-glx-260 ;then
                                VideoDriver="nvidia"
                        fi
                ;;
                Radeon|ATI)
            if [[ -e /etc/X11/xorg.conf ]]; then curdrv=$(grep Driver /etc/X11/xorg.conf | cut -d'"' -f2);
                if [[ $curdrv == "radeon" ]]; then PackageIsInstalled xserver-xorg-video-ati && VideoDriver="radeon" ;;
                    else PackageIsInstalled xorg-driver-fglrx && VideoDriver="fglrx" ;;
                    fi
            fi

                Intel) VideoDriver="intel" ;;
                "") VideoDriver="vesa" ;; # just-in-case default
        esac
#<-mkr_B_via_e->
        echo "$VideoDriver"
}

ReloadDevicesOnThisMachine()
{
        for Dev in $(cat /usr/pluto/locks/pluto_spawned_local_devices.txt); do
                /usr/pluto/bin/MessageSend "$DCERouter" 0 "$Dev" 7 1 163 "Utils.sh ReloadDevicesOnThisMachine"
        done
}

OpenGLeffects()
{
        local Q

        Q="
                SELECT IK_DeviceData
                FROM Device
                LEFT JOIN Device AS Parent ON Parent.PK_Device=Device.FK_Device_ControlledVia
                JOIN Device_DeviceData ON Device.PK_Device=FK_Device
                WHERE
                        Device.FK_DeviceTemplate='$DEVICETEMPLATE_OnScreen_Orbiter'
                        AND (
                                Device.FK_Device_ControlledVia='$PK_Device'
                                OR Parent.FK_Device_ControlledVia='$PK_Device'
                        )
                AND FK_DeviceData='$DEVICEDATA_Use_OpenGL_effects'
        "
        RunSQL "$Q"
}

AlphaBlendingEnabled()
{
        local Q

        Q="
                SELECT IK_DeviceData
                FROM Device
                LEFT JOIN Device AS Parent ON Parent.PK_Device=Device.FK_Device_ControlledVia
                JOIN Device_DeviceData ON Device.PK_Device=FK_Device
                WHERE
                        Device.FK_DeviceTemplate='$DEVICETEMPLATE_OnScreen_Orbiter'
                        AND (
                                Device.FK_Device_ControlledVia='$PK_Device'
                                OR Parent.FK_Device_ControlledVia='$PK_Device'
                        )
                AND FK_DeviceData='$DEVICEDATA_Use_alpha_blended_UI'
        "
        RunSQL "$Q"
}

GetDeviceData()
{
        local Q
        local Device="$1" DeviceData="$2"

        Q="
                SELECT IK_DeviceData
                FROM Device_DeviceData
                WHERE FK_Device='$Device' AND FK_DeviceData='$DeviceData'
        "
        Field 1 "$(RunSQL "$Q")"
}

SetDeviceData()
{
        local Q
        local Device="$1" DeviceData="$2" Value="$3"

        Q="
                UPDATE Device_DeviceData
                SET IK_DeviceData='$Value'
                WHERE FK_Device=$Device AND FK_DeviceData=$DeviceData
        "
        RunSQL "$Q"
}

UI_SetOptions()
{
        local OrbiterDev="$1"
        local OpenGLeffects="$2"
        local AlphaBlending="$3"
        local UI_Version="$4"

        # disable OpenGL effects
        Q="
                REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
                VALUES('$OrbiterDev', '$DEVICEDATA_Use_OpenGL_effects', '$OpenGLeffects')
        "
        RunSQL "$Q"
        # disable alpha blending
        Q="
                REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
                VALUES('$OrbiterDev', '$DEVICEDATA_Use_alpha_blended_UI', '$AlphaBlending')
        "
        RunSQL "$Q"
        # select UI
        Q="
                REPLACE INTO Device_DeviceData(FK_Device, FK_DeviceData, IK_DeviceData)
                VALUES('$OrbiterDev', '$DEVICEDATA_PK_UI', '$UI_Version')
        "
        RunSQL "$Q"
}

function GeneratePassword() {
        #TODO: Replace with this --->  </dev/urandom tr -dc A-Za-z0-9_ | head -c8
        local -a alpha1=(Q W E R T Y U I O P A S D F G H J K L Z X C V B N M)
        local -a alpha2=(q w e r t y u i o p a s d f g h j k l z x c v b n m)
        local -a alpha3=(1 2 3 4 5 6 7 8 9 0)

        local pass=""
        pass=$pass"${alpha1[$(($RANDOM%26))]}${alpha1[$(($RANDOM%26))]}${alpha1[$(($RANDOM%26))]}"
        pass=$pass"${alpha2[$(($RANDOM%26))]}${alpha2[$(($RANDOM%26))]}${alpha2[$(($RANDOM%26))]}"
        pass=$pass"${alpha3[$(($RANDOM%10))]}${alpha3[$(($RANDOM%10))]}"

        local fromwhere=$(( $RANDOM % 3 + 1 ))
        [[ $fromwhere == 1 ]] && pass=$pass"${alpha1[$(($RANDOM%26))]}"
        [[ $fromwhere == 2 ]] && pass=$pass"${alpha2[$(($RANDOM%26))]}"
        [[ $fromwhere == 3 ]] && pass=$pass"${alpha3[$(($RANDOM%10))]}"


        for i in `seq 1 100` ;do
                local split=$(( $RANDOM % ${#pass} + 1 ))
                pass1=${pass:$split}
                pass2=${pass:0:$split}
                pass="${pass1}${pass2}"
        done

        echo $pass
}

function GeneratePasswordOf6Digits()
{
        local pass
        for ((i = 0; i < 6; i++)); do
                pass="${pass}$((RANDOM % 10))"
        done
        echo "$pass"
}

Log()
{
        local File="$1"; shift
        local Msg="$*"

        echo "LOG: $Msg"
        echo "$Msg" >>"$File"
}


function BlacklistConfFiles()
{
        local file=$1

        if [[ -e /etc/confblacklist ]] ;then
                while read line; do
                        if [[ "$line" == "$file" ]] ;then
                                return 0
                        fi
                done < /etc/confblacklist
        fi

        return 1
}

function VDRInstalled() {
        # Return true if VDR is installed
        DEVICETEMPLATE_VDR_Plugin="1704"
        Q="SELECT PK_Device FROM Device Where FK_DeviceTemplate = $DEVICETEMPLATE_VDR_Plugin"
        VDRDevice=$(RunSQL "$Q")                                         
        if [ "$VDRDevice" == "" ] ; then                                 
                RETURNVALUE=1                                             
        else                                                             
                RETURNVALUE=0                                             
        fi                                                               
        return $RETURNVALUE
}

Let's see if we can get it right.
« Last Edit: November 25, 2011, 07:31:10 pm by l3mce »
I never quit... I just ping out.

l3mce

  • NEEDS to work for LinuxMCE
  • ***
  • Posts: 1084
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #13 on: November 25, 2011, 07:44:38 pm »
Ok... this isn't working in 1004 at all due to some other issue causing panic. I am going to have to make a clone of my current setup, then revert back to 810 so I can see what is going on with my non-fglrx ati stuff.

I will not have an answer until later today.
« Last Edit: November 25, 2011, 07:47:13 pm by l3mce »
I never quit... I just ping out.

Roman

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
Re: ATI and Intel correct autodetect round two. Need testers. Very easy.
« Reply #14 on: November 25, 2011, 08:31:22 pm »
I tried both and it ended up with again an X Error like before.

I then did the same procedure like before from the link, then I strated the AVWizard manually again.
Now I get a black screen with the white pointer on it. No UI1 surface.

Should I delete this MD competely via the webinterface of the core and start everything from scratch?
Do you need any log files helping you?

i keep it like it is so far unless you request any informations or changes, ok?

best regards
Roman