-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split startup into root and non-root parts.
- Loading branch information
1 parent
4397562
commit a35324b
Showing
3 changed files
with
90 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
%wheel ALL= NOPASSWD: /sbin/shutdown /usr/sbin/iw /sbin/ifconfig /sbin/route /sbin/reboot /usr/sbin/alsactl /usr/share/unicsy/ofone/ofone /usr/bin/amixer | ||
%wheel ALL= NOPASSWD: /sbin/shutdown /usr/sbin/iw /sbin/ifconfig /sbin/route /sbin/reboot /usr/sbin/alsactl /usr/share/unicsy/ofone/ofone /usr/share/unicsy/startup/root_startup /usr/bin/amixer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/python2 | ||
|
||
from __future__ import print_function | ||
|
||
import sys | ||
sys.path += [ "/usr/share/unicsy/lib" ] | ||
|
||
import time | ||
import os | ||
import hardware | ||
import watchdog | ||
|
||
def sy(s): | ||
os.system(s) | ||
|
||
class Startup: | ||
def __init__(m): | ||
m.wd = watchdog.StartupWatchdog() | ||
|
||
def run(m): | ||
print("Unicsy/root starting up") | ||
|
||
wd = m.wd | ||
debian = True | ||
|
||
try: | ||
os.chdir('/my/tui/ofone') | ||
except: | ||
debian = False | ||
print("Not on debian") | ||
|
||
# Disable yellow battery light: | ||
hardware.enable_access('/sys/class/power_supply/bq24150a-0/stat_pin_enable') | ||
sy('echo 0 > /sys/class/power_supply/bq24150a-0/stat_pin_enable') | ||
# Enable charger control from non-root | ||
hardware.enable_access('/sys/class/power_supply/bq24150a-0/current_limit') | ||
# Enable hardware control from non-root, for tefone etc. | ||
hardware.enable_access('/sys/class/leds/lp5523:*/brightness') | ||
hardware.enable_access('/sys/class/backlight/acx565akm/brightness') | ||
hardware.enable_access('/sys/power/state') | ||
# keyd needs /dev/input access | ||
hardware.enable_access('/dev/input/event6') | ||
hardware.enable_access('/dev/input/event5') | ||
hardware.enable_access('/dev/input/event1') | ||
hardware.enable_access('/dev/input/event0') | ||
# power management | ||
sy('sudo mount /dev/zero -t debugfs /sys/kernel/debug/') | ||
sy('sudo chmod 755 /sys/kernel/debug') | ||
hardware.enable_access('/sys/kernel/debug/pm_debug/enable_off_mode') | ||
# This allows us to configure network. It is also extremely bad idea | ||
hardware.enable_access('/etc/resolv.conf') | ||
|
||
hardware.hw.startup() | ||
|
||
s = Startup() | ||
s.run() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters