/[gentoo-x86]/eclass/nvidia-driver.eclass
Gentoo

Diff of /eclass/nvidia-driver.eclass

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

Revision 1.18 Revision 1.19
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/nvidia-driver.eclass,v 1.18 2012/11/27 17:39:48 jer Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/nvidia-driver.eclass,v 1.19 2013/04/08 06:44:05 mr_bones_ Exp $
4 4
5# @ECLASS: nvidia-driver.eclass 5# @ECLASS: nvidia-driver.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# chainsaw@gentoo.org 7# chainsaw@gentoo.org
8# @AUTHOR: 8# @AUTHOR:
48 48
49# @FUNCTION: nvidia-driver-get-card 49# @FUNCTION: nvidia-driver-get-card
50# @DESCRIPTION: 50# @DESCRIPTION:
51# Retrieve the PCI device ID for each Nvidia video card you have 51# Retrieve the PCI device ID for each Nvidia video card you have
52nvidia-driver-get-card() { 52nvidia-driver-get-card() {
53 local NVIDIA_CARD="$(/usr/sbin/lspci -d 10de: -n | \ 53 local NVIDIA_CARD="$(/usr/sbin/lspci -d 10de: -n | awk -F'[: ]' '/ 0300: /{print $6}')"
54 awk '/ 0300: /{print $3}' | cut -d: -f2 | tr '\n' ' ')"
55 54
56 if [ -n "$NVIDIA_CARD" ]; then 55 if [ -n "$NVIDIA_CARD" ]; then
57 echo "$NVIDIA_CARD"; 56 echo "$NVIDIA_CARD"
58 else 57 else
59 echo "0000"; 58 echo 0000
60 fi 59 fi
61} 60}
62 61
63nvidia-driver-get-mask() { 62nvidia-driver-get-mask() {
64 local NVIDIA_CARDS="$(nvidia-driver-get-card)" 63 local NVIDIA_CARDS="$(nvidia-driver-get-card)"
64 local card drv
65
65 for card in $NVIDIA_CARDS; do 66 for card in $NVIDIA_CARDS; do
66 for drv in $drv_96xx; do 67 for drv in $drv_96xx; do
67 if [ "x$card" = "x$drv" ]; then 68 if [ "x$card" = "x$drv" ]; then
68 echo "$mask_96xx"; 69 echo "$mask_96xx"
69 return 0; 70 return 0
70 fi 71 fi
71 done 72 done
72 73
73 for drv in $drv_71xx; do 74 for drv in $drv_71xx; do
74 if [ "x$card" = "x$drv" ]; then 75 if [ "x$card" = "x$drv" ]; then
75 echo "$mask_71xx"; 76 echo "$mask_71xx"
76 return 0; 77 return 0
77 fi 78 fi
78 done 79 done
79 80
80 for drv in $drv_173x; do 81 for drv in $drv_173x; do
81 if [ "x$card" = "x$drv" ]; then 82 if [ "x$card" = "x$drv" ]; then
82 echo "$mask_173x"; 83 echo "$mask_173x"
83 return 0; 84 return 0
84 fi 85 fi
85 done 86 done
86 87
87 for drv in $drv_304x; do 88 for drv in $drv_304x; do
88 if [ "x$card" = "x$drv" ]; then 89 if [ "x$card" = "x$drv" ]; then
89 echo "$mask_304x"; 90 echo "$mask_304x"
90 return 0; 91 return 0
91 fi 92 fi
92 done 93 done
93 done 94 done
94 95
95 echo ""; 96 echo ''
96 return 1; 97 return 1
97} 98}
98 99
99# @FUNCTION: nvidia-driver-check-warning 100# @FUNCTION: nvidia-driver-check-warning
100# @DESCRIPTION: 101# @DESCRIPTION:
101# Prints out a warning if the driver does not work w/ the installed video card 102# Prints out a warning if the driver does not work w/ the installed video card
102nvidia-driver-check-warning() { 103nvidia-driver-check-warning() {
103 local NVIDIA_MASK="$(nvidia-driver-get-mask)" 104 local NVIDIA_MASK="$(nvidia-driver-get-mask)"
105
104 if [ -n "$NVIDIA_MASK" ]; then 106 if [ -n "$NVIDIA_MASK" ]; then
105 version_compare "${NVIDIA_MASK##*-}" "${PV}" 107 version_compare "${NVIDIA_MASK##*-}" "${PV}"
106 r=$? 108 r=$?
107 109
108 if [ "x$r" = "x1" ]; then 110 if [ "x$r" = "x1" ]; then

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20