Magellan Linux

Diff of /trunk/hwinfo/emulate-hwsetup.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2676 by niro, Thu Jul 23 15:40:36 2015 UTC revision 2677 by niro, Fri Jul 24 10:47:30 2015 UTC
# Line 45  check_unsupported_drivers() Line 45  check_unsupported_drivers()
45   return 0   return 0
46  }  }
47    
48    get_gfxcard_sysfsid_from_specific_hwid()
49    {
50     local SEARCH_ID="$1"
51     local hwid
52     local sysfsid
53     local counter
54    
55     declare -i counter=0
56    
57     echo "${GFXCARD_INFO}" | while read line
58     do
59     # get hwinfo device id, its always the first line
60     if [[ ${counter} = 0 ]]
61     then
62     # hwids begins all with ^ID:, sub informations have an empty space
63     hwid=$(echo "${line}" | grep '^[0-9].*' | sed 's:\(^[0-9]*\)\:\ .*:\1:')
64     fi
65    
66     # search for device id
67     if [[ ${SEARCH_ID} = ${hwid} ]]
68     then
69     case "${line}" in
70     *'SysFS ID:'*)
71     # subst the id
72     sysfsid="${line#*:}"
73     # trim spaces
74     sysfsid="${sysfsid// }"
75     echo "${sysfsid}"
76     ;;
77     esac
78     fi
79    
80     # next hardware item
81     if [[ -z ${line} ]]
82     then
83     counter=0
84     else
85     ((counter++))
86     fi
87     done
88    }
89    
90    get_primary_display_hwid()
91    {
92     local hwid
93     hwid="$(echo "${GFXCARD_INFO}" | grep 'Primary display adapter:' | sed 's:.*\:\ \#\([0-9]*\):\1:')"
94     echo "${hwid}"
95    }
96    
97    
98  # disable probeonly, load all modules by default  # disable probeonly, load all modules by default
99  probeonly=0  probeonly=0
100    
# Line 63  done Line 113  done
113  echo -n "Autoconfiguring devices...  " 1>&2  echo -n "Autoconfiguring devices...  " 1>&2
114    
115  GFXCARD_INFO="$(${HWINFO} --gfxcard)"  GFXCARD_INFO="$(${HWINFO} --gfxcard)"
116    # check for a primary device and rerun hwinfo for this device only
117    primary_display_hwid="$(get_primary_display_hwid)"
118    if [[ -n ${primary_display_hwid} ]]
119    then
120     GFXCARD_INFO="$(${HWINFO} --gfxcard --only $(get_gfxcard_sysfsid_from_specific_hwid ${primary_display_hwid}))"
121    fi
122  NETCARD_INFO="$(${HWINFO} --netcard)"  NETCARD_INFO="$(${HWINFO} --netcard)"
123  MOUSE_INFO="$(${HWINFO} --mouse)"  MOUSE_INFO="$(${HWINFO} --mouse)"
124    

Legend:
Removed from v.2676  
changed lines
  Added in v.2677