2
by Carl Richell
fixed nvidia rotation bug #118854 fixed laptop and desktop suspend support on feisty bug #114675 |
1 |
#!/usr/bin/env python
|
2 |
#
|
|
3 |
## System76, Inc.
|
|
4 |
## Copyright System76, Inc.
|
|
5 |
## Released under the GNU General Public License (See LICENSE)
|
|
6 |
##
|
|
7 |
## Fixes Suspend and Hibernate on System76 machines
|
|
8 |
import os |
|
24
by Carl Richell
-------------------------------------- |
9 |
import fileinput |
6
by Carl Richell
backup acpi files before inserting new |
10 |
import time |
39
by Carl Richell
* Fix Starling Ultra (star1) wireless in Ubuntu 9.10 |
11 |
import ubuntuversion |
6
by Carl Richell
backup acpi files before inserting new |
12 |
|
13 |
today = time.strftime('%Y%m%d_h%Hm%Ms%S') |
|
2
by Carl Richell
fixed nvidia rotation bug #118854 fixed laptop and desktop suspend support on feisty bug #114675 |
14 |
|
15 |
def acpi1(): |
|
16 |
"""Configures S1 sleep"""
|
|
6
by Carl Richell
backup acpi files before inserting new |
17 |
os.system('sudo cp /etc/default/acpi-support /etc/default/acpi-support_sys76backup_%s' % today) |
2
by Carl Richell
fixed nvidia rotation bug #118854 fixed laptop and desktop suspend support on feisty bug #114675 |
18 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/feisty/acpi-support /etc/default/acpi-support') |
19 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/feisty/89-brightup.sh /etc/acpi/resume.d/89-brightup.sh') |
|
6
by Carl Richell
backup acpi files before inserting new |
20 |
os.system('sudo cp /etc/acpi/resume.d/60-asus-wireless-led.sh /etc/acpi/resume.d/60-asus-wireless-led.sh_sys76backup_%s' % today) |
4
by Carl Richell
Fix network-manager wireless interface recognition after resume |
21 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/feisty/60-asus-wireless-led.sh /etc/acpi/resume.d/60-asus-wireless-led.sh') |
2
by Carl Richell
fixed nvidia rotation bug #118854 fixed laptop and desktop suspend support on feisty bug #114675 |
22 |
|
23 |
def acpi2(): |
|
24 |
"""Configures S3 sleep"""
|
|
6
by Carl Richell
backup acpi files before inserting new |
25 |
os.system('sudo cp /etc/default/acpi-support /etc/default/acpi-support_sys76backup_%s' % today) |
2
by Carl Richell
fixed nvidia rotation bug #118854 fixed laptop and desktop suspend support on feisty bug #114675 |
26 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/gazv3/acpi-support /etc/default/acpi-support') |
4
by Carl Richell
Fix network-manager wireless interface recognition after resume |
27 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/feisty/89-brightup.sh /etc/acpi/resume.d/89-brightup.sh') |
6
by Carl Richell
backup acpi files before inserting new |
28 |
os.system('sudo cp /etc/acpi/resume.d/60-asus-wireless-led.sh /etc/acpi/resume.d/60-asus-wireless-led.sh_sys76backup_%s' % today) |
11.1.5
by Carl Richell
1.) Fix Darter Headphone Sensing Bug #130669 |
29 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/feisty/60-asus-wireless-led.sh /etc/acpi/resume.d/60-asus-wireless-led.sh') |
30 |
||
24
by Carl Richell
-------------------------------------- |
31 |
def acpi3(): |
32 |
"""Configures S1 sleep on Ubuntu 7.10"""
|
|
33 |
os.system('sudo cp /etc/default/acpi-support /etc/default/acpi-support_sys76backup_%s' % today) |
|
34 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/gutsy/acpi-support /etc/default/acpi-support') |
|
35 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/feisty/89-brightup.sh /etc/acpi/resume.d/89-brightup.sh') |
|
36 |
os.system('sudo cp /etc/acpi/resume.d/60-asus-wireless-led.sh /etc/acpi/resume.d/60-asus-wireless-led.sh_sys76backup_%s' % today) |
|
37 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/feisty/60-asus-wireless-led.sh /etc/acpi/resume.d/60-asus-wireless-led.sh') |
|
33
by Carl Richell
Fix daru1 touchpad on/off hotkey |
38 |
|
39 |
def acpi4(): |
|
40 |
"""Removes script used to temporarly fix Suspend with DRM on daru3
|
|
41 |
Bug was fixed in Ubuntu"""
|
|
42 |
os.system('sudo rm /etc/pm/sleep.d/00CPU') |
|
24
by Carl Richell
-------------------------------------- |
43 |
|
44 |
def daru2(): |
|
11.1.5
by Carl Richell
1.) Fix Darter Headphone Sensing Bug #130669 |
45 |
"""Fix dsdt tables in daru2"""
|
46 |
||
24
by Carl Richell
-------------------------------------- |
47 |
# Determine running kernel version
|
11.1.5
by Carl Richell
1.) Fix Darter Headphone Sensing Bug #130669 |
48 |
b = os.popen('uname -r') |
49 |
try: |
|
50 |
uname = b.readline().strip() |
|
51 |
finally: |
|
52 |
b.close() |
|
53 |
kernel = uname |
|
54 |
||
22
by Carl Richell
1.) Clean out legacy unnecessary drivers |
55 |
os.system('sudo sh /opt/system76/system76-driver/src/acpi/initrd-add-dsdt.sh /boot/initrd.img-%s /opt/system76/system76-driver/src/acpi/daru2/DSDT.aml' % kernel) |
24
by Carl Richell
-------------------------------------- |
56 |
os.system('sudo cp /opt/system76/system76-driver/src/acpi/daru2/DSDT.aml /etc/initramfs-tools/DSDT.aml') |
57 |
||
58 |
'''The ec_intr=0 option passes the embedded controller interupt
|
|
59 |
to the kernel at boot. On Ubuntu 7.10 the option fixes acpi
|
|
60 |
battery notification problems.'''
|
|
61 |
||
62 |
os.system('sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_sys76backup_%s' % today) |
|
63 |
||
64 |
grub_menu = fileinput.input('/boot/grub/menu.lst', inplace=1) |
|
65 |
for line in grub_menu: |
|
66 |
print line.replace(' ec_intr=0',''), |
|
67 |
grub_menu = fileinput.input('/boot/grub/menu.lst', inplace=1) |
|
68 |
for line in grub_menu: |
|
69 |
print line.replace('splash','splash ec_intr=0'), |
|
32
by Carl Richell
1.) Fix panp4 mic and sound after resume LP #264516 |
70 |
|
71 |
def osiNotWindows(): |
|
72 |
# Kernel parameter tells the BIOS that the system is not Windows 2006
|
|
73 |
||
74 |
os.system('sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_sys76backup_%s' % today) |
|
75 |
||
76 |
grub_menu = fileinput.input('/boot/grub/menu.lst', inplace=1) |
|
77 |
for line in grub_menu: |
|
78 |
print line.replace(' acpi_osi="!Windows 2006"',''), |
|
79 |
grub_menu = fileinput.input('/boot/grub/menu.lst', inplace=1) |
|
80 |
for line in grub_menu: |
|
81 |
print line.replace('splash','splash acpi_osi="!Windows 2006"'), |
|
35
by Carl Richell
1.) Add Starling Netbook (star1) |
82 |
|
39
by Carl Richell
* Fix Starling Ultra (star1) wireless in Ubuntu 9.10 |
83 |
def lemu1(): |
84 |
# Kernel parameter tells the BIOS that the OS is Linux
|
|
85 |
||
86 |
os.system('sudo cp /etc/default/grub /etc/default/grub_sys76backup_%s' % today) |
|
87 |
||
88 |
grub_menu = fileinput.input('/etc/default/grub', inplace=1) |
|
89 |
for line in grub_menu: |
|
90 |
print line.replace(' acpi_os_name=Linux acpi_osi=',''), |
|
91 |
grub_menu = fileinput.input('/etc/default/grub', inplace=1) |
|
92 |
for line in grub_menu: |
|
93 |
print line.replace('splash','splash acpi_os_name=Linux acpi_osi='), |
|
94 |
os.system('sudo update-grub') |
|
95 |
||
96 |
def serp6(): |
|
97 |
# Kernel parameter tells the BIOS that the OS is Linux
|
|
98 |
||
99 |
os.system('sudo cp /etc/default/grub /etc/default/grub_sys76backup_%s' % today) |
|
100 |
||
101 |
grub_menu = fileinput.input('/etc/default/grub', inplace=1) |
|
102 |
for line in grub_menu: |
|
103 |
print line.replace(' acpi_os_name=Linux acpi_osi=Linux',''), |
|
104 |
grub_menu = fileinput.input('/etc/default/grub', inplace=1) |
|
105 |
for line in grub_menu: |
|
106 |
print line.replace('splash','splash acpi_os_name=Linux acpi_osi=Linux'), |
|
107 |
os.system('sudo update-grub') |
|
108 |
||
35
by Carl Richell
1.) Add Starling Netbook (star1) |
109 |
def star1(): |
110 |
||
111 |
# Fix pciehp for SD card reader
|
|
39
by Carl Richell
* Fix Starling Ultra (star1) wireless in Ubuntu 9.10 |
112 |
version = ubuntuversion.release() |
35
by Carl Richell
1.) Add Starling Netbook (star1) |
113 |
|
39
by Carl Richell
* Fix Starling Ultra (star1) wireless in Ubuntu 9.10 |
114 |
if version == ('9.04'): |
115 |
os.system('sudo cp /boot/grub/menu.lst /boot/grub/menu.lst_sys76backup_%s' % today) |
|
116 |
||
117 |
grub_menu = fileinput.input('/boot/grub/menu.lst', inplace=1) |
|
118 |
for line in grub_menu: |
|
119 |
print line.replace(' pciehp.pciehp_force=1',''), |
|
120 |
grub_menu = fileinput.input('/boot/grub/menu.lst', inplace=1) |
|
121 |
for line in grub_menu: |
|
122 |
print line.replace('splash','splash pciehp.pciehp_force=1'), |
|
123 |
elif version == ('9.10'): |
|
124 |
os.system('sudo cp /etc/default/grub /etc/default/grub_sys76backup_%s' % today) |
|
125 |
||
126 |
grub_menu = fileinput.input('/etc/default/grub', inplace=1) |
|
127 |
for line in grub_menu: |
|
128 |
print line.replace(' pciehp.pciehp_force=1',''), |
|
129 |
grub_menu = fileinput.input('/etc/default/grub', inplace=1) |
|
130 |
for line in grub_menu: |
|
131 |
print line.replace('splash','splash pciehp.pciehp_force=1'), |
|
132 |
os.system('sudo update-grub') |