933fd1a70c87f2da40f140d7505508e7034e133c
1 *** README for omhacks
3 It is a fast and simple library of common openmoko utility functions.
5 There is a very simple command line front-end called "om", which exposes all
6 the library functions. Just run om to get its command line help.
8 The extra om-led executable is the same as running "om led", but is also
9 provided separately so that it's possible to make "om-led" suid but not "om".
11 If you need another function in the library, please send a patch. Please try to
12 keep in the minimalist spirit of the library, and also provide a command line
13 front end.
15 omhacks can optionally be hooked to suspend/resume in various
16 ways. /usr/share/doc/omhacks/examples/00at is an example on how to
17 configure the phone to wake up using RTC alarm to run at
18 jobs.
20 /usr/lib/pm-utils/sleep.d/omhacks.so is a hook that is used only if
21 pm-utils-light is installed, normal pm-utils ignores it. It turns the
22 blue LED on during suspend/resume so that you an easily see if the
23 phone gets stuck while executing suspend/resume scripts. It also
24 automatically resuspends the phone if it was woken up by usb
25 disconnect event. The touchscreen and backlight are kept disabled when
26 this resuspending is taking place. When you unplug the usb cable you
27 should only see the blue LED light for a few seconds.
30 ** pm-utils-light omhacks.so hooks
32 omhacks installs some pm-utils-light suspend hooks, using its dynamic hooks
33 feature to have fast, lightweight hooks implemented in C.
35 The hooks provided by omhacks.so are:
37 Name On suspend On resume
38 00-statusled Turn on blue led Turn on blue led
39 74-screen Turn off screen Turn on screen
40 98-cancel-on-usb-disconnect - Cancel resume if reason is
41 USB disconnect
42 99-statusled Turn off blue led Turn off blue led
44 If you do not want one of these hooks to run, just create an empty file
45 /etc/pm/sleep.d/NN-HOOKNAME and make sure it is not executable. It will
46 override and disable the hook in /usr as pm-utils hooks are expected to do.
49 *** TODO list
51 - Write the at hook also as a shlib, and package it so that it works both with
52 pm-utils and with pm-utils-light
54 18:00 #openmoko-debian < lindi-> enrico: btw, how about using "on|off" instead of 0 and 1?
55 18:00 #openmoko-debian < enrico> lindi-: I thought about it, since I keep using 'on' and turning things off because
56 atoi("on") is 0
57 18:01 #openmoko-debian < lindi-> but 1 and 0 sound very odd indeed. almost no command uses that kind of logic
58 - get rid of *_swap() in omhacks
59 - instead of keeping a table of sysfs names, scan things and create symlink in
60 /var/run/omhacks/
61 http://wiki.openmoko.org/wiki/GTA02_sysfs
63 enrico> lindi-: after reading that thread on -kernel, I decided that the way to go is a
64 symlink farm in /var/run/omhacks
65 enrico> lindi-: yes, there's a lot of code duplication. I think it's ok so far, eventually
66 we'll see a way to collapse it into something sensible
67 lindi-> enrico: when is /var/run available? can you use omhacks on initramfs?
68 lindi-> enrico: i'd like to be able to force 500 mA charging in the very beginning of
69 initramfs
70 lindi-> enrico: it's always a tradeoff :(
71 lindi-> enrico: any idea why running plain 'om' opens /dev/urandom?
72 enrico> lindi-: erhm, I see wrt initramfs. You have a point
73 enrico> lindi-: OTOH, we can fail gracefully and return the real pathname instead of the
74 symlink
75 lindi-> enrico: I already dim backlight in the very beginning of boot to make my phone boot
76 with low battery
77 enrico> lindi-: and just use the symlink instead of the cache, as a sort of persistent
78 cache. If there's no /var/run, then skip the symlink
79 enrico> no idea why plain om opens urandom. I really can't think why
80 lindi-> enrico: ok using the symlink as a fallback is probably good idea
81 enrico> maybe "break open" in gdb should tell you when it happens
83 20:16 #openmoko-debian < lindi-> enrico: also, access() is useless
84 20:16 #openmoko-debian < lindi-> enrico: why could just have "FILE *try_open(const char *list_of_alternatives[])"
85 that tries to fopen() each alternative and returns NULL if all failed
86 20:17 #openmoko-debian < lindi-> s/why/we/
87 20:17 #openmoko-debian < lindi-> then one of the alternatives could be the symlink path
88 20:19 #openmoko-debian < enrico> lindi-: I thought access was faster than open
89 20:20 #openmoko-debian < enrico> lindi-: ah, you mean, combining the search with the opening, like a sysfs_open
90 20:20 #openmoko-debian < enrico> lindi-: interesting... clever...
92 22:14 #openmoko-debian < lindi-> enrico: it stays asleep and when i resume using button it still has fix
93 22:14 #openmoko-debian < lindi-> enrico: so works perfectly. now just implement "om gps ubx /dev/gps
94 go-to-low-power-state" to make it also save energy
96 - recreate lindi's suspend/resume scripts
97 http://lindi.iki.fi/lindi/openmoko/custom-scripts.txt
98 - My goals
99 - stand-alone pppd
100 + turn gsm on/off (done)
101 - turn gsm really on (can be done in pppd's chatscript)
102 http://lindi.iki.fi/lindi/openmoko/manual-call.txt
103 - wake up alarm
104 + at hook, date +%s > $STORAGE/last-resume
105 - "alert" script redone
106 - for desktop and moko
107 - with config file
108 - on/off go back to sleep if triggered within 1 minute from resume
109 (no need to look at resume_reason)
110 - on/off moko specific
111 - inputs (listen to aux button instead of keyboard/mouse)
112 - audio (fiddle with mixer)
113 - vibration / leds (flash aux so one can see what to push in
114 the dark)
115 - X display to use if undefined
116 - ringtone
117 - run maximised
118 enrico> lindi-: the hook works! scheduling jobs with at will wake up the phone and at will
119 run the scheduled job *right away*
120 enrico> lindi-: now I need to tweak your alert script a bit, so that if it's run within one minute from resume and noone pushes aux while it's being noisy, then it goes back to sleep
121 enrico> lindi-: then any at job can be followed by a run of that alert script, and it solves the issue of going back to sleep at the end of the job
122 enrico> lindi-: for extra kicks, the at script can have an option to run a program in background and also wait for it to end before suspending
124 - Example of an at job that goes back to sleep at the end, if resume reason
125 was rtcwake and there has been no meaningful input
126 - GSM
127 - turn on all, inc. PIN
128 - GPS
129 - suspend/resume GPS, saving/restoring status
130 - lindi-> enrico: http://lists.openmoko.org/nabble.html#nabble-td2476690 has info about low power mode
131 - 00:08 #openmoko-debian < lindi-> enrico: | http://downloads.openmoko.org/developer/sources/svn/omgps.googlecode.com/svn/trunk/omgps/src/ubx.c seems to have routines for this
132 00:09 #openmoko-debian < lindi-> enrico: README from Jul 2009 says 'Omgps is a GPS application for OpenMolo mobile phone.'
133 00:10 #openmoko-debian < lindi-> enrico: so we have yet another GPS program :)
135 - set funky parameters
136 - keep GPS on during suspend
137 - set stationary threshold for different profiles (Automotive = 3, pedestrian = 2, stationary = 1)
138 http://lists.linuxtogo.org/pipermail/smartphones-userland/2009-October/002037.html
139 http://wiki.openmoko.org/wiki/Neo_FreeRunner_GPS#UBX_protocol
140 http://lists.openmoko.org/pipermail/openmoko-kernel/2008-July/004047.html
141 http://people.openmoko.org/tony_tu/src/u-blox/AssistNowOfflineServerSampleImplementation/
142 http://svn.openmoko.org/developers/matt_hsu/agps-online/
143 00:29 #openmoko-debian < lindi-> enrico: 'om gps keep-on-in-suspend' does not say anything to the gps chip. does
144 this really work? won't it wake up the main cpu since it is sending coordinates
145 constantly?
146 00:30 #openmoko-debian < enrico> lindi-: I have *no* idea
147 00:30 #openmoko-debian < enrico> lindi-: it's too cold outside now to test it
148 00:30 #openmoko-debian < lindi-> since there's some UBX command to put the GPS chip to a "keep fix but don't
149 actively track and report coordinates" mode
151 20:37 #openmoko-debian < enrico> lindi-: in fact I can code that ubxgen in C
152 20:37 #openmoko-debian < lindi-> enrico: yes
153 20:38 #openmoko-debian < lindi-> enrico: together with manual page that has examples it would be very useful tool
154 - Wifi
155 - ask the kernel people what is the proper way to turn it on/off, and to check if it's on
156 - .vapi for omhacks, to use in zavai
157 - battery
158 - read, monitor
159 20:18 #openmoko-debian < lindi-> enrico: how about adding "energy" and "consumption" to om?
160 20:19 #openmoko-debian < lindi-> enrico: and usb_curlimit
161 20:19 #openmoko-debian < lindi-> and host/device modes
162 - fork pm-utils-light off omhacks
164 - reduce the size of lindi's ~/bin/
165 http://lindi.iki.fi/lindi/openmoko/custom-scripts.txt
166 16:18 #openmoko-debian < enrico> lindi-: a few questions:
167 16:18 #openmoko-debian < enrico> lindi-: 2. what's the fiddling with sysrq-trigger?
168 16:19 #openmoko-debian < enrico> lindi-: 3. why touch /tmp/frameworkd.pid ?
169 -------------------------------------------------------------------------------------------------------------------
170 16:40 #openmoko-debian < lindi-> enrico: 2. sysrq trigger just makes sure kernel does not log anything on resume
171 to display, this used to slow things down a lot with debugging information
172 16:40 #openmoko-debian < lindi-> enrico: 3. gsm-watchdog looks at the freshness of /tmp/frameworkd.pid
173 16:41 #openmoko-debian < lindi-> enrico: 3. (Right after resume ogsmd won't respond to dbus. touching pid file
174 makes sure the watchdog does not immediately kill ogsmd in this case but waits
175 for a while)
177 - leds
178 http://www.mjmwired.net/kernel/Documentation/leds-class.txt
179 From: Richard Purdie <rpurdie@rpsys.net>
180 Cc: openmoko-kernel <openmoko-kernel@lists.openmoko.org>
181 Subject: Re: Renaming of devices in 2.6.31
182 [...]
183 Note that the sysfs people hate me for this. They would want you to go
184 through each directory in /sys/class/leds/ opening
185 the /sys/class/leds/*/function file and reading it to find what you
186 want. So it could be much worse!
