summaryrefslogtreecommitdiff
path: root/hooks-addons/51via_openchrome
blob: 3a13d2fe41c4876b1f6b8af14cd2bfa5296bcc0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# hook addon for thin clients with chip VIA

make_launcher() {
cat << EOF > ${DESTDIR}/scripts/tcos-bottom/15via_openchrome
#!/bin/sh
#

# new header not using prereqs
if [ "\$1" = "prereqs" ]; then
  echo ""
  exit 0
fi


quiet=n

. /scripts/functions
. /conf/tcos.conf
. /conf/tcos-run-functions

test1=0
test1=\$(get_vga_vendor 1106)


if [ "\$test1" != "1" ]; then
   # not in client with chip VIA unichrome
   exit 0
fi

log_begin_msg "Loading Via Openchrome drivers"

  modprobe drm
  modprobe via

[ "\$TCOS_XORG_VIDEO_DRIVER" = "fullauto" ] && exit 0
[ "\$TCOS_XORG_VIDEO_DRIVER" = "xorgauto" ] && exit 0

  if [ -f /usr/lib/xorg/modules/drivers/openchrome_drv.so ]; then
    configurexorg --newsettings --xdriver=openchrome --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
  else
    configurexorg --newsettings --xdriver=via --outputfile=/etc/X11/xorg.conf 2>> /tmp/initramfs.debug
  fi

log_end_msg \$?

EOF
chmod +x ${DESTDIR}/scripts/tcos-bottom/15via_openchrome

}

if [ $TCOS_ETC_GENERIC ]; then
	  stat_before
	 
	    manual_add_modules drm
	    manual_add_modules via-agp
	    manual_add_modules via
	    manual_add_modules i2c-viapro

	  stat_after "Generic VIA modules support"

fi

if [ $TCOS_XORG_DRIVER_OPENCHROME ];then

	test_driver1=$(strings /usr/lib/xorg/modules/drivers/via_drv.so 2> /dev/null| grep -c openchrome)
	test_driver2=$(strings /usr/lib/xorg/modules/drivers/openchrome_drv.so 2> /dev/null | grep -c openchrome)

	if [ -z $TCOS_ETC_GENERIC ];then
	    manual_add_modules drm
	    manual_add_modules via-agp
	    manual_add_modules via
	    manual_add_modules i2c-viapro
	fi

	if [ $TCOS_XORG_DRIVER_OPENCHROME ] && [ "$test_driver1" != 0 ] ; then
	  stat_before
	    cpifexists /usr/lib/libviaXvMC.so /usr/lib
	    cpifexists /usr/lib/libviaXvMCPro.so /usr/lib
	    [ -e /etc/X11/XvMCConfig ] && cpifexists /etc/X11/XvMCConfig /etc/X11


	    mkdir -p ${DESTDIR}/usr/lib/dri
	    cpifexists /usr/lib/dri/unichrome_dri.so /usr/lib/dri
	    make_launcher

	  stat_after "VIA Openchrome driver support"

	elif [ $TCOS_XORG_DRIVER_OPENCHROME ] && [ "$test_driver2" != 0 ] ; then
	 stat_before
        manual_add_modules via_chrome9
	    cpifexists /usr/lib/libchromeXvMC.so /usr/lib
	    cpifexists /usr/lib/libchromeXvMCPro.so /usr/lib
	    [ -e /etc/X11/XvMCConfig ] && cpifexists /etc/X11/XvMCConfig /etc/X11

	    mkdir -p ${DESTDIR}/usr/lib/dri
	    cpifexists /usr/lib/dri/unichrome_dri.so /usr/lib/dri
	    make_launcher

	 stat_after "Openchrome driver support"


	elif [ $TCOS_XORG_DRIVER_OPENCHROME ] && [ "$test_driver1" = 0 ] && [ "$test_driver2" = 0 ]; then
	  echo ""
	  echo "   WARNING: Use Openchrome drivers enabled but don't have installed via/openchrome package"
	  echo ""
	  echo "            Please install openchrome VIA drivers package"
	  echo ""
	fi

fi