Send commitlog mailing list submissions to
commitlog@lists.openmoko.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. development tree for U-Boot: Changes to 'andy'
([EMAIL PROTECTED])
2. development tree for U-Boot: Changes to 'stable'
([EMAIL PROTECTED])
3. development tree for U-Boot: Changes to 'andy'
([EMAIL PROTECTED])
4. Openmoko's OpenEmbedded repository. This is used to build the
Openmoko distribution: Changes to 'org.openmoko.asu.dev'
([EMAIL PROTECTED])
5. r4527 - developers/john_lee/pyfso ([EMAIL PROTECTED])
--- Begin Message ---
Rebased ref, commits from common ancestor:
commit 53c9bd51b52f3b41d71fc2dd823e4ff73af01e20
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:14:15 2008 +0100
deadbat-safe-voltage.patch
This patch finally enables the last bit of Matt's "safe battery voltage"
patch. Before the other changes in this series of patches, the
wait_for_power logic didn't really work anyway, but now we need this
protection.
I've lowered the safe voltage from 3.6V to 3.4V, since the system seems
to boot fine with 3.4V. A smaller threshold decreases the time the
system spends refusing to do anything but to charge.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 1e1410ba46c624e545ed1703986db59f73e77406
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:14:11 2008 +0100
deadbat-alternate.patch
When there is no battery or the battery is in its cut-off state, even the
slightest charge (once the capacitors on the battery rail are filled) will
drive the battery voltage up to VB_SYS.
The battery voltage monitor therefore only reports garbage. We work around
this problem by alternating the LED with the charger, so that the battery
only gets charged half of the time. We then measure right at the end of a
LED cycle, i.e., when the battery voltage has had time to return to the
level that really represents the battery state.
(Note: battery voltage drops quickly, so giving it one whole second to
drain is very much on the safe side.)
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit b663ea63563e4c6b19f788477692bc09a3d7978d
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:14:07 2008 +0100
deadbat-gta02v5-noled.patch
The LEDs of GTA02v5 draw an excessive amount of current, which can sometimes
push us out of our current budget while running from 100mA. This patch turns
the blinking LED off if we're on GTA02v5.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 9f788dcc9c6761ec338f7a172911e1e32dd1c3a8
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:14:03 2008 +0100
fix-early-upll.patch
During early initialization, the UPLL only ran at 3/4 speed.
This is swiftly corrected in board_init, but better do it right the
first time.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit d96e96d5eec2fd13de91f5183bfbd4ca683609b2
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:13:59 2008 +0100
deadbat-cpu-200.patch
Raise the CPU clock (FCLK) from 200MHz to 400MHz only after we've
established
that we have a good power source.
That way, the little bit of processing that are done in wait_for_power cause
less spikes in current consumption, which decreases the risk of running out
of power while waiting for USB signaling or similar.
We also save about 7mA of static consumption.
We need to do this awkward two-step process, once in board_init and then
again in board_late_init, since various clocks that depend on PCLK are
calculated after board_init (and start.S uses yet another set of different
settings).
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 967bd3baccc104d5657846ba4ed66c669f498f8a
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:13:55 2008 +0100
deadbat-cpu-idle.patch
This patch makes the CPU enter IDLE mode while waiting in wait_for_power.
To wake up from IDLE mode, we need an interrupt. Note that this interrupt
only needs to be signaled to the CPU, but the CPU does not have to execute
it. However, it has to clear the interrupt or, upon returning from the
interrupt handler, the system will immediately be interrupted by the same
interrupt.
We have the following sources of external events:
- battery insertion / battery voltage rises above Vth(batok)
- USB insertion (giving us 100mA)
- adapter insertion (giving us 1A)
- USB host signals availability of 500mA
- 1Hz tick
USB signaling is already handled by an interrupt handler, so we just use
what's there. USB insertion and the 1Hz tick cause PMU interrupts, so we
need to enable the interrupt path from the PMU. Adapter insertion is
handled as part of USB insertion.
We don't wake up from IDLE on battery insertion or when the battery
voltage rises above the threshold. Instead, we just poll for it on each
1Hz tick.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 6d0431712c076a832f462054adcf2b8201130c5a
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:13:50 2008 +0100
deadbat-defer-glamo.patch
This patch defers initialization of the Glamo core, and in particular
enabling the clocks, until we're sure to have good power. This reduces
the power budget we need in early boot by about 15mA.
This patch also cleans up the remains of related code that has already
been moved to a later boot phase.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit dfed9cc17ea65a6fe0448f45a12bed950f402ede
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:13:46 2008 +0100
deadbat-soft-start.patch
This patch sets the maximum USB fast charge current to 100mA instead of
1A. This is an attempt to reduce the inrush current of the battery and
circuits directly attached to the battery.
Without change, the comparably large capacitors on subsystems that are
directly supplied from the battery would cause a sharp drop of VB_SYS,
which prompted the PMU to reset.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 20716cb52c3eee4d418ee50640ee78ff850ad051
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:13:40 2008 +0100
deadbat-defer-ldo.patch
This patch defers the enabling of LDO regulators that are not needed during
early boot. (In fact, LDO1, LDO2, and LDO5 are not needed while in u-boot
at all.) These are:
- LDO1 (GSENSOR_3V3)
- LDO2 (CODEC_3V3)
- LDO5 (RF_3V)
- LDO6 (LCM_3V)
Enabling them after we've established that we have a good power source
reduces the USB current budget by about 40mA.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 579930fbe92f36a50babf830e8373d161382c067
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:13:34 2008 +0100
deadbat-wait-silently.patch
In wait_for_power, we switch the AUX LED on and off every second. There's
no real need to noisily report this on the console.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 96611475add0ea5019d693cfa088a8343701546b
Author: Andy Green <[EMAIL PROTECTED]>
Date: Sun Jun 29 21:28:32 2008 +0100
uboot-fix-OOCCTL-reset-phase.patch
System reset comes up too early according to how OOCTL
has been set. Change to come up in activation state 4
not 1.
Signed-off-by: Andy Green <[EMAIL PROTECTED]>
commit 78b9f3d351436ef14fc38a96082bf9299a3932e9
Author: Andy Green <[EMAIL PROTECTED]>
Date: Sun May 18 12:55:48 2008 +0100
add-find-wake-reason.patch
Currently we don't take care about the resume reason.
This patch captures it into the spare GSTATUS 4 register
and so passes it up into Linux.
Signed-off-by: Andy Green <[EMAIL PROTECTED]>
commit 4ec60973cf2e028de905f6ea1f81ef99ca60d834
Author: michael <[EMAIL PROTECTED]>
Date: Fri May 9 14:35:10 2008 +0100
nand_skip_bad.patch
Change the skip bad block. Avoid false positives by only checking
the beginning of a block and check the second page
Signed-off-by: michael <[EMAIL PROTECTED]>
commit 19a477b3d04148f0142058c45f7e1a34dfd412db
Author: warmcat <[EMAIL PROTECTED]>
Date: Fri Apr 11 14:45:54 2008 +0100
fix-rtc_get_return.patch
rtc_get has changed to have an int return, not void any more.
Signed-off-by: Andy Green <[EMAIL PROTECTED]>
commit a5a7ebd4fb672ff4c950d5b4bd8e2540484e0161
Author: warmcat <[EMAIL PROTECTED]>
Date: Fri Apr 11 14:45:54 2008 +0100
uboot-fix-lcm-flicker.patch
commit 7e36139ffa3b4bc59c2f0d3a6aeee0c0185d7a2f
Author: Andy Green <[EMAIL PROTECTED]>
Date: Fri Apr 11 14:45:54 2008 +0100
uboot-force-backlight-on.patch
"Special feature" of pcf50633 -- a documented feature though --
means that you may need to perform a little sequence of actions to
get the backlight to come back on.
This patch does the sequence in U-Boot so that we no longer have
the sticky "off" state for the backlight if you reset while the
backlight was down in Linux.
Signed-off-by: Andy Green <[EMAIL PROTECTED]>
commit 1ebdcad82c9c37bae7a7ee86c10b0bbff83d53ff
Author: warmcat <[EMAIL PROTECTED]>
Date: Fri Apr 11 14:45:54 2008 +0100
stop-internetworking-warning.patch
Stops compiler warning noise on build
commit 8c17f29e213115598308dee9e50450cdf8b6c5eb
Author: warmcat <[EMAIL PROTECTED]>
Date: Fri Apr 11 14:45:54 2008 +0100
Build scripts
--- End Message ---
--- Begin Message ---
board/neo1973/gta02/gta02.c | 144 ++++++++++++++++++++++++++++++++++-----
board/neo1973/gta02/pcf50633.c | 22 ++-----
cpu/arm920t/start.S | 2 +-
drivers/video/smedia3362.c | 15 +----
4 files changed, 132 insertions(+), 51 deletions(-)
New commits:
commit 4c53f3417cd7181f5b4ae2de0cd4481468d3a63d
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:34:20 2008 +0100
deadbat-safe-voltage.patch
This patch finally enables the last bit of Matt's "safe battery voltage"
patch. Before the other changes in this series of patches, the
wait_for_power logic didn't really work anyway, but now we need this
protection.
I've lowered the safe voltage from 3.6V to 3.4V, since the system seems
to boot fine with 3.4V. A smaller threshold decreases the time the
system spends refusing to do anything but to charge.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 8fa55aac744e8d787492227fd4b21d14528f1735
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:34:09 2008 +0100
deadbat-alternate.patch
When there is no battery or the battery is in its cut-off state, even the
slightest charge (once the capacitors on the battery rail are filled) will
drive the battery voltage up to VB_SYS.
The battery voltage monitor therefore only reports garbage. We work around
this problem by alternating the LED with the charger, so that the battery
only gets charged half of the time. We then measure right at the end of a
LED cycle, i.e., when the battery voltage has had time to return to the
level that really represents the battery state.
(Note: battery voltage drops quickly, so giving it one whole second to
drain is very much on the safe side.)
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 718426fdc01e8a2e2210fc40bd21e0c7eb0d25e2
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:57 2008 +0100
deadbat-gta02v5-noled.patch
The LEDs of GTA02v5 draw an excessive amount of current, which can sometimes
push us out of our current budget while running from 100mA. This patch turns
the blinking LED off if we're on GTA02v5.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit cd57a43e495d125cbff0da7fce36c02a9a4588de
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:43 2008 +0100
fix-early-upll.patch
During early initialization, the UPLL only ran at 3/4 speed.
This is swiftly corrected in board_init, but better do it right the
first time.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 539eeece8bb08f806a38acd0513341f944aaab5d
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:33 2008 +0100
deadbat-cpu-200.patch
Raise the CPU clock (FCLK) from 200MHz to 400MHz only after we've
established
that we have a good power source.
That way, the little bit of processing that are done in wait_for_power cause
less spikes in current consumption, which decreases the risk of running out
of power while waiting for USB signaling or similar.
We also save about 7mA of static consumption.
We need to do this awkward two-step process, once in board_init and then
again in board_late_init, since various clocks that depend on PCLK are
calculated after board_init (and start.S uses yet another set of different
settings).
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 0f0533a0434cdb71247bb308c225d2b372331dfc
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:24 2008 +0100
deadbat-cpu-idle.patch
This patch makes the CPU enter IDLE mode while waiting in wait_for_power.
To wake up from IDLE mode, we need an interrupt. Note that this interrupt
only needs to be signaled to the CPU, but the CPU does not have to execute
it. However, it has to clear the interrupt or, upon returning from the
interrupt handler, the system will immediately be interrupted by the same
interrupt.
We have the following sources of external events:
- battery insertion / battery voltage rises above Vth(batok)
- USB insertion (giving us 100mA)
- adapter insertion (giving us 1A)
- USB host signals availability of 500mA
- 1Hz tick
USB signaling is already handled by an interrupt handler, so we just use
what's there. USB insertion and the 1Hz tick cause PMU interrupts, so we
need to enable the interrupt path from the PMU. Adapter insertion is
handled as part of USB insertion.
We don't wake up from IDLE on battery insertion or when the battery
voltage rises above the threshold. Instead, we just poll for it on each
1Hz tick.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 1e126c864247702abaf78b9f7def168f5904dca5
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:05 2008 +0100
deadbat-defer-glamo.patch
This patch defers initialization of the Glamo core, and in particular
enabling the clocks, until we're sure to have good power. This reduces
the power budget we need in early boot by about 15mA.
This patch also cleans up the remains of related code that has already
been moved to a later boot phase.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit ce1e253ee6e75870534a9005dcfd1aad03fdbbbe
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:32:57 2008 +0100
deadbat-soft-start.patch
This patch sets the maximum USB fast charge current to 100mA instead of
1A. This is an attempt to reduce the inrush current of the battery and
circuits directly attached to the battery.
Without change, the comparably large capacitors on subsystems that are
directly supplied from the battery would cause a sharp drop of VB_SYS,
which prompted the PMU to reset.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 77ef5a9f920092fcebfe592607b7866ac36e3c8e
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:32:46 2008 +0100
deadbat-defer-ldo.patch
This patch defers the enabling of LDO regulators that are not needed during
early boot. (In fact, LDO1, LDO2, and LDO5 are not needed while in u-boot
at all.) These are:
- LDO1 (GSENSOR_3V3)
- LDO2 (CODEC_3V3)
- LDO5 (RF_3V)
- LDO6 (LCM_3V)
Enabling them after we've established that we have a good power source
reduces the USB current budget by about 40mA.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 3f38474f96a3d58e7b28052e643e2867ced6bd5b
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:13:34 2008 +0100
deadbat-wait-silently.patch
In wait_for_power, we switch the AUX LED on and off every second. There's
no real need to noisily report this on the console.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---
Rebased ref, commits from common ancestor:
commit 4c53f3417cd7181f5b4ae2de0cd4481468d3a63d
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:34:20 2008 +0100
deadbat-safe-voltage.patch
This patch finally enables the last bit of Matt's "safe battery voltage"
patch. Before the other changes in this series of patches, the
wait_for_power logic didn't really work anyway, but now we need this
protection.
I've lowered the safe voltage from 3.6V to 3.4V, since the system seems
to boot fine with 3.4V. A smaller threshold decreases the time the
system spends refusing to do anything but to charge.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 8fa55aac744e8d787492227fd4b21d14528f1735
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:34:09 2008 +0100
deadbat-alternate.patch
When there is no battery or the battery is in its cut-off state, even the
slightest charge (once the capacitors on the battery rail are filled) will
drive the battery voltage up to VB_SYS.
The battery voltage monitor therefore only reports garbage. We work around
this problem by alternating the LED with the charger, so that the battery
only gets charged half of the time. We then measure right at the end of a
LED cycle, i.e., when the battery voltage has had time to return to the
level that really represents the battery state.
(Note: battery voltage drops quickly, so giving it one whole second to
drain is very much on the safe side.)
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 718426fdc01e8a2e2210fc40bd21e0c7eb0d25e2
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:57 2008 +0100
deadbat-gta02v5-noled.patch
The LEDs of GTA02v5 draw an excessive amount of current, which can sometimes
push us out of our current budget while running from 100mA. This patch turns
the blinking LED off if we're on GTA02v5.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit cd57a43e495d125cbff0da7fce36c02a9a4588de
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:43 2008 +0100
fix-early-upll.patch
During early initialization, the UPLL only ran at 3/4 speed.
This is swiftly corrected in board_init, but better do it right the
first time.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 539eeece8bb08f806a38acd0513341f944aaab5d
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:33 2008 +0100
deadbat-cpu-200.patch
Raise the CPU clock (FCLK) from 200MHz to 400MHz only after we've
established
that we have a good power source.
That way, the little bit of processing that are done in wait_for_power cause
less spikes in current consumption, which decreases the risk of running out
of power while waiting for USB signaling or similar.
We also save about 7mA of static consumption.
We need to do this awkward two-step process, once in board_init and then
again in board_late_init, since various clocks that depend on PCLK are
calculated after board_init (and start.S uses yet another set of different
settings).
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 0f0533a0434cdb71247bb308c225d2b372331dfc
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:24 2008 +0100
deadbat-cpu-idle.patch
This patch makes the CPU enter IDLE mode while waiting in wait_for_power.
To wake up from IDLE mode, we need an interrupt. Note that this interrupt
only needs to be signaled to the CPU, but the CPU does not have to execute
it. However, it has to clear the interrupt or, upon returning from the
interrupt handler, the system will immediately be interrupted by the same
interrupt.
We have the following sources of external events:
- battery insertion / battery voltage rises above Vth(batok)
- USB insertion (giving us 100mA)
- adapter insertion (giving us 1A)
- USB host signals availability of 500mA
- 1Hz tick
USB signaling is already handled by an interrupt handler, so we just use
what's there. USB insertion and the 1Hz tick cause PMU interrupts, so we
need to enable the interrupt path from the PMU. Adapter insertion is
handled as part of USB insertion.
We don't wake up from IDLE on battery insertion or when the battery
voltage rises above the threshold. Instead, we just poll for it on each
1Hz tick.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 1e126c864247702abaf78b9f7def168f5904dca5
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:33:05 2008 +0100
deadbat-defer-glamo.patch
This patch defers initialization of the Glamo core, and in particular
enabling the clocks, until we're sure to have good power. This reduces
the power budget we need in early boot by about 15mA.
This patch also cleans up the remains of related code that has already
been moved to a later boot phase.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit ce1e253ee6e75870534a9005dcfd1aad03fdbbbe
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:32:57 2008 +0100
deadbat-soft-start.patch
This patch sets the maximum USB fast charge current to 100mA instead of
1A. This is an attempt to reduce the inrush current of the battery and
circuits directly attached to the battery.
Without change, the comparably large capacitors on subsystems that are
directly supplied from the battery would cause a sharp drop of VB_SYS,
which prompted the PMU to reset.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 77ef5a9f920092fcebfe592607b7866ac36e3c8e
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:32:46 2008 +0100
deadbat-defer-ldo.patch
This patch defers the enabling of LDO regulators that are not needed during
early boot. (In fact, LDO1, LDO2, and LDO5 are not needed while in u-boot
at all.) These are:
- LDO1 (GSENSOR_3V3)
- LDO2 (CODEC_3V3)
- LDO5 (RF_3V)
- LDO6 (LCM_3V)
Enabling them after we've established that we have a good power source
reduces the USB current budget by about 40mA.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
commit 3f38474f96a3d58e7b28052e643e2867ced6bd5b
Author: Werner Almesberger <[EMAIL PROTECTED]>
Date: Tue Jul 15 12:13:34 2008 +0100
deadbat-wait-silently.patch
In wait_for_power, we switch the AUX LED on and off every second. There's
no real need to noisily report this on the console.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---
packages/tasks/task-openmoko-asu-feed.bb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 187d4aea2ba906de5b41dc95a85ede71ae4e5b7f
Author: Julian_chu <[EMAIL PROTECTED]>
Date: Tue Jul 15 22:03:50 2008 +0800
[openmoko-asu-feed] Fix a stupid mistake
diversity-nav_svn.bb -> diversity-nav
--- End Message ---
--- Begin Message ---
Author: john_lee
Date: 2008-07-15 16:03:32 +0200 (Tue, 15 Jul 2008)
New Revision: 4527
Added:
developers/john_lee/pyfso/__init__.py
developers/john_lee/pyfso/accelerometer.py
developers/john_lee/pyfso/dialer.py
developers/john_lee/pyfso/fso_backend.py
developers/john_lee/pyfso/general.py
Log:
stuffs abstracted from another project trying to create a python
binding for fso dbus api.
* accelerometer.py needs to be integrated into frameworkd
* dialer.py a simple dialer implementation that depends on
fso_backend.py
* fso_backend.py a dbus wrapper. the biggest problem is that it
uses main loop from e_dbus.
* general.py some general base classes. Singleton pattern still got
bug.
Added: developers/john_lee/pyfso/__init__.py
===================================================================
--- developers/john_lee/pyfso/__init__.py (rev 0)
+++ developers/john_lee/pyfso/__init__.py 2008-07-15 14:03:32 UTC (rev
4527)
@@ -0,0 +1,4 @@
+from accelerometer import Accelerometer, MockAccelerometer, \
+ InputDevAccelerometer, Gta02Accelerometer, get_xy_theta
+
+from dialer import Dialer, MockDialer, FSODialer
Added: developers/john_lee/pyfso/accelerometer.py
===================================================================
--- developers/john_lee/pyfso/accelerometer.py (rev 0)
+++ developers/john_lee/pyfso/accelerometer.py 2008-07-15 14:03:32 UTC (rev
4527)
@@ -0,0 +1,274 @@
+"""
+Accelerometer class. It can run in two different modes. In pull
+mode, it accepts read request then retrieve accelerometer values. In
+daemon mode, it updates itself as often as possible, notifies the
+observers about value changes and answers request with its current
+state.
+
+(C) 2008 John Lee <[EMAIL PROTECTED]>
+(C) 2008 Openmoko, Inc.
+GPLv2 or later
+"""
+from __future__ import with_statement
+from general import Subject
+
+import math
+import os
+import struct
+from threading import RLock
+from time import sleep
+
+class Accelerometer(Subject):
+ """The base class of all accelerometers.
+ """
+
+ def __new__(cls, *args, **kwargs):
+ cls.sample_rate = property(cls._get_sample_rate, cls._set_sample_rate)
+ obj = object.__new__(cls, *args, **kwargs)
+ return obj
+
+ def __init__(self, device, sample_rate=None):
+ """device: the name of the input
+ sample_rate: how many samples per second
+ """
+ super(Accelerometer, self).__init__()
+ self._statelock = RLock()
+ self._state = (0, -1000, 0)
+ self._open_device(device)
+ self._daemonized = False
+ if sample_rate is not None:
+ self.sample_rate = sample_rate
+
+ def _open_device(self, device):
+ raise NotImplementedError
+
+ def _get_sample_rate(self):
+ """get sample rate
+ """
+ raise NotImplementedError
+
+ def _set_sample_rate(self, sample_rate):
+ """set sample rate
+ """
+ raise NotImplementedError
+
+ def _retrieve(self):
+ """read and parse the current values. could be time
+ consuming.
+ """
+ raise NotImplementedError
+
+ @property
+ def state(self):
+ """return the current state
+ """
+ if self._daemonized:
+ with self._statelock:
+ return self._state
+ else:
+ state = self._retrieve()
+ with self._statelock:
+ self._state = state
+ return self._state
+
+ def daemonize(self):
+ """a infinite loop to update self.state. will notify
+ observers about state changes.
+ """
+ self._daemonized = True
+ while self._daemonized:
+ state = self._retrieve()
+ with self._statelock:
+ self._state = state
+ self._notify(self._state)
+
+ def stop(self):
+ """stop daemon
+ """
+ self._daemonized = False
+
+
+class MockAccelerometer(Accelerometer):
+ """Mock accelerometer class.
+ >>> g = MockAccelerometer()
+ >>> g.sample_rate
+ 100
+ >>> g.sample_rate = 400
+ >>> g.sample_rate
+ 400
+ """
+
+ def __init__(self):
+ super(MockAccelerometer, self).__init__(None)
+ self.sample_rate = 100
+
+ def _open_device(self, device):
+ pass
+
+ def _set_sample_rate(self, sample_rate):
+ self._sample_rate = sample_rate
+
+ def _get_sample_rate(self):
+ return self._sample_rate
+
+ def _retrieve(self):
+ sleep(1/self._sample_rate)
+ return (0, -1000, 0)
+
+
+class InputDevAccelerometer(Accelerometer):
+ """Read values from kernel input device
+ """
+
+ # Event types
+ EV_SYN = 0x00
+ EV_KEY = 0x01
+ EV_REL = 0x02
+ EV_ABS = 0x03
+ EV_MSC = 0x04
+ EV_SW = 0x05
+ EV_LED = 0x11
+ EV_SND = 0x12
+ EV_REP = 0x14
+ EV_FF = 0x15
+ EV_PWR = 0x16
+ EV_FF = 0x17
+ EV_MAX = 0x1f
+ EV_CNT = (EV_MAX+1)
+
+ # Relative axes
+ REL_X = 0x00
+ REL_Y = 0x01
+ REL_Z = 0x02
+ REL_RX = 0x03
+ REL_RY = 0x04
+ REL_RZ = 0x05
+ REL_HWHEEL = 0x06
+ REL_DIAL = 0x07
+ REL_WHEEL = 0x08
+ REL_MISC = 0x09
+ REL_MAX = 0x0f
+ REL_CNT = REL_MAX + 1
+
+ input_event_struct = "@llHHi"
+ input_event_size = struct.calcsize(input_event_struct)
+
+ def __init__(self, *args, **kwargs):
+ super(InputDevAccelerometer, self).__init__(*args, **kwargs)
+
+ def _open_device(self, device):
+ self.device = os.open(device, os.O_RDONLY | os.O_SYNC)
+
+ def _unpack(self):
+ """struct input_event {
+ struct timeval time; /* (long, long) */
+ __u16 type;
+ __u16 code;
+ __s32 value;
+ };
+ return (tv_sec, tv_usec, type, code, value)
+ """
+ for i in xrange(0, 5):
+ data = os.read(self.device, InputDevAccelerometer.input_event_size)
+ if len(data) >= InputDevAccelerometer.input_event_size:
+ break;
+ else:
+ raise Exception()
+
+ return struct.unpack(InputDevAccelerometer.input_event_struct, data)
+
+ def _unpack_xyz(self):
+ """return a 3 tuple
+ """
+ # wait for EV_SYN
+ while self._unpack()[2] != InputDevAccelerometer.EV_SYN:
+ pass
+ # now return (x, y, z)
+ return (self._unpack()[4], self._unpack()[4], self._unpack()[4])
+
+
+class Gta02Accelerometer(InputDevAccelerometer):
+ """Read values from gta02. for now we use just one.
+ >>> g = Gta02Accelerometer()
+ >>> g.sample_rate = 400
+ >>> g.sample_rate
+ 400
+ >>> g.sample_rate = 100
+ >>> g.sample_rate
+ 100
+ """
+
+ INPUT_DEV = '/dev/input/event3'
+ SYS_SAMPLE_RATE =
'/sys/devices/platform/spi_s3c24xx_gpio.1/spi0.1/sample_rate'
+
+ def __init__(self, device=None, sample_rate=None):
+ if device == None:
+ device = Gta02Accelerometer.INPUT_DEV
+ super(Gta02Accelerometer, self).__init__(device, sample_rate)
+
+ def _set_sample_rate(self, sample_rate):
+ """possible values: 100, 400
+ """
+ f = open(Gta02Accelerometer.SYS_SAMPLE_RATE, 'w', 0)
+ f.write('%d\n' % sample_rate)
+ f.close()
+
+ def _get_sample_rate(self):
+ f = open(Gta02Accelerometer.SYS_SAMPLE_RATE, 'r', 0)
+ sample_rate = int(f.read())
+ f.close()
+ return sample_rate
+
+ def _retrieve(self):
+ return self._unpack_xyz()
+
+
+# shamelessly stole from olv
+def get_xy_theta(u):
+ """get the angle related to (0, -1), clockwise.
+ return 0 < theta < 2pi.
+ >>> get_xy_theta((0, -1000, 0))
+ 0.0
+ """
+ uu = u[0] * u[0] + u[1] * u[1]
+ theta = math.acos(-u[1] / math.sqrt(uu))
+ if (u[0] < 0):
+ theta = 2 * math.pi - theta
+ return theta
+
+
+class DumpObserver(object):
+ """Does nothing but print the subject state when notified.
+ """
+
+ def __init__(self, subject=None):
+ if subject == None:
+ subject = MockAccelerometer()
+ subject.attach(self)
+ self.subject = subject
+
+ def update(self, state):
+ t = get_xy_theta(state)
+ print 'x = %d, y = %d, z = %d, theta = %f pi' % (state + (t / math.pi,
))
+
+
+def dump():
+ try:
+ gsensor = Gta02Accelerometer(sample_rate=400)
+ except OSError:
+ gsensor = MockAccelerometer()
+ DumpObserver(gsensor)
+ gsensor.daemonize()
+
+
+def _doctest():
+ try:
+ import doctest
+ except ImportError:
+ return
+ else:
+ doctest.testmod()
+
+
+if __name__ == '__main__':
+ _doctest()
Added: developers/john_lee/pyfso/dialer.py
===================================================================
--- developers/john_lee/pyfso/dialer.py (rev 0)
+++ developers/john_lee/pyfso/dialer.py 2008-07-15 14:03:32 UTC (rev 4527)
@@ -0,0 +1,139 @@
+from general import Subject
+from fso_backend import FSOObject
+from dbus import DBusException
+from threading import Timer
+
+class Dialer(Subject):
+ """dial, pickup and hangup should be called by controller. state
+ change like 'incoming', 'active', 'outgoing' and 'release' should
+ be set directly to dialer.state
+ """
+ def __init__(self):
+ Subject.__init__(self)
+
+ def dial(self, number):
+ raise NotImplementedError
+
+ def pickup(self):
+ raise NotImplementedError
+
+ def hangup(self):
+ raise NotImplementedError
+
+ # make this read only to hint this should not be changed from
+ # outside.
+ @property
+ def state(self):
+ return self._state
+
+ def _set_state(self, state):
+ self._state = state
+ self._notify(state)
+
+
+class MockDialer(Dialer):
+ def __init__(self):
+ """initiate an incoming call first
+ """
+ super(MockDialer, self).__init__()
+ self._set_state('incoming')
+
+ def dial(self, number):
+ print 'mock dialer dial:', number
+ Timer(1, self._set_state, args=('outgoing', )).start()
+
+ def pickup(self):
+ print 'mock dialer pickup'
+ Timer(1, self._set_state, args=('active', )).start()
+
+ def hangup(self):
+ print 'mock dialer hangup'
+ Timer(1, self._set_state, args=('release', )).start()
+
+ def _set_state(self, state):
+ print 'mock dialer', state
+ super(MockDialer, self)._set_state(state)
+
+
+def need_registered(real_f):
+ def decorator(self, *args, **kwargs):
+ if self.registered:
+ return real_f(self, *args, **kwargs)
+ else:
+ return False
+ return decorator
+
+
+def need_initialized(real_f):
+ def decorator(self, *args, **kwargs):
+ if self.initialized:
+ return real_f(self, *args, **kwargs)
+ else:
+ return False
+ return decorator
+
+
+class FSODialer(Dialer):
+ """A Dialer implementation based on fso dbus API.
+ """
+ def __init__(self):
+ super(FSODialer, self).__init__()
+ self.callid = None
+ self.initialized = False
+ self.registered = False
+ self.fso = FSOObject()
+ from threading import Thread
+ # put the slow init function into background
+ Thread(target=self._init).start()
+ # FIXME: get state from fso and set self state
+ self._set_state('release')
+
+ def _init(self):
+ if not self.fso.initialize():
+ return
+ self.fso.onCallStatus.append(self.on_call_status)
+ self.initialized = True
+ if not self._register():
+ return
+ self.registered = True
+ return True
+
+ def _register(self):
+ if self.fso.gsm_network_iface.GetStatus()['registration'] ==
'unregistered':
+ try:
+ self.fso.gsm_device_iface.SetAntennaPower(True)
+ self.fso.gsm_network_iface.Register()
+ print 'registered'
+ except DBusException, e:
+ # FIXME pin number?
+ print e
+ self.registered = False
+ return False
+ return True
+
+ @need_registered
+ def dial(self, number):
+ self.fso.gsm_call_iface.Initiate(number, "voice")
+
+ @need_registered
+ def hangup(self):
+ self.fso.gsm_call_iface.Release(self.callid)
+
+ @need_registered
+ def pickup(self):
+ self.fso.gsm_call_iface.Activate(self.callid)
+
+ @need_registered
+ def on_call_status(self, id, status, properties):
+ self._set_state(status)
+ self.callid = id
+
+
+def _test():
+ import ecore
+ FSODialer()
+ ecore.main_loop_begin()
+
+
+if __name__ == "__main__":
+ _test()
Added: developers/john_lee/pyfso/fso_backend.py
===================================================================
--- developers/john_lee/pyfso/fso_backend.py (rev 0)
+++ developers/john_lee/pyfso/fso_backend.py 2008-07-15 14:03:32 UTC (rev
4527)
@@ -0,0 +1,185 @@
+import e_dbus
+import os
+from dbus import DBusException, SystemBus, Interface
+from general import Singleton
+
+class FSOObject(Singleton):
+ """ based on the code from zhone but it's a singleton class now.
+ """
+
+ def __init__( self ):
+ self.objects = {}
+ self.onResourceChanged = []
+ self.onCallStatus = []
+ self.onNetworkStatus = []
+ self.onIdleStateChanged = []
+ self.onSignalStrength = []
+ self.ignoreSuspend = False
+
+ self.framework_obj = None
+ self.gsm_device_obj = None
+ self.gsm_device_iface = None
+ self.usage_iface = None
+ self.device_iface = None
+ self.device_power_iface = None
+ self.idlenotifier_obj = None
+ self.idlenotifier_iface = None
+ self.inputnotifier_obj = None
+ self.inputnotifier_iface = None
+ self.display_obj = None
+ self.display_iface = None
+
+ self.fullinit = False
+
+ def tryGetProxy( self, busname, objname ):
+ obj = None
+ try:
+ obj = self.objects[ "%s:%s" % ( busname, objname ) ]
+ except KeyError:
+ try:
+ obj = self.bus.get_object( busname, objname )
+ except DBusException, e:
+ print "could not create proxy for %s:%s" % ( busname, objname
), e
+ else:
+ self.objects[ "%s:%s" % ( busname, objname ) ] = obj
+ return obj
+
+ def initialize( self ):
+ if self.fullinit:
+ return True
+ try:
+ self.bus = SystemBus( mainloop=e_dbus.DBusEcoreMainLoop() )
+ except DBusException, e:
+ print "could not connect to dbus_object system bus:", e
+ return False
+
+ # Framework
+ fw_obj = self.tryGetProxy( 'org.freesmartphone.frameworkd',
'/org/freesmartphone/Framework' )
+ if fw_obj is None:
+ print ( "could not connect to org.freesmartphone.frameworkd -- is
the framework daemon started?" )
+ return False
+ else:
+ self.fw = Interface( fw_obj, "org.freesmartphone.Objects" )
+ failcount = 0
+
+ # Usage
+ self.usage_obj = self.tryGetProxy( 'org.freesmartphone.ousaged',
'/org/freesmartphone/Usage' )
+ if ( self.usage_obj is not None ) and ( self.usage_iface is None ):
+ self.usage_iface = Interface(self.usage_obj,
'org.freesmartphone.Usage')
+ self.usage_iface.connect_to_signal( "ResourceChanged",
self.cbResourceChanged )
+ self.usage_iface.RequestResource("GSM")
+ if self.usage_obj is None:
+ failcount += 1
+ else:
+ print "usage ok", self.usage_iface
+
+ # Phone
+ self.gsm_device_obj = self.tryGetProxy( 'org.freesmartphone.ogpsd',
'/org/freesmartphone/GSM/Device' )
+ print self.gsm_device_obj
+
+ if ( self.gsm_device_obj is not None ) and ( self.gsm_device_iface is
None ):
+ print "creating gsm interfaces"
+ self.gsm_device_iface = Interface(self.gsm_device_obj,
'org.freesmartphone.GSM.Device')
+ self.gsm_sim_iface = Interface(self.gsm_device_obj,
'org.freesmartphone.GSM.SIM')
+ self.gsm_network_iface = Interface(self.gsm_device_obj,
'org.freesmartphone.GSM.Network')
+ self.gsm_call_iface = Interface(self.gsm_device_obj,
'org.freesmartphone.GSM.Call')
+ self.gsm_test_iface = Interface(self.gsm_device_obj,
'org.freesmartphone.GSM.Test')
+ self.gsm_call_iface.connect_to_signal( "CallStatus",
self.cbCallStatus )
+ self.gsm_network_iface.connect_to_signal( "Status",
self.cbNetworkStatus )
+ self.gsm_network_iface.connect_to_signal('SignalStrength',
self.cbSignalStrength)
+ if self.gsm_device_obj is None:
+ failcount += 1
+ else:
+ print "gsm ok", self.gsm_network_iface
+
+ self.device_obj = self.tryGetProxy( 'org.freesmartphone.odeviced',
'/org/freesmartphone/Device' )
+ if ( self.device_obj is not None ) and ( self.device_iface is None ):
+ self.device_iface = Interface( self.device_obj,
'org.freesmartphone.Device' )
+
+ self.device_power_obj = self.tryGetProxy(
"org.freesmartphone.odeviced", self.fw.ListObjectsByInterface(
"org.freesmartphone.Device.PowerSupply" )[0] )
+ self.device_power_iface = Interface(self.device_power_obj,
'org.freesmartphone.Device.PowerSupply')
+
+ self.idlenotifier_obj = self.tryGetProxy(
"org.freesmartphone.odeviced", self.fw.ListObjectsByInterface(
"org.freesmartphone.Device.IdleNotifier" )[0] )
+
+ self.idlenotifier_iface = Interface( self.idlenotifier_obj,
"org.freesmartphone.Device.IdleNotifier" )
+ self.idlenotifier_iface.connect_to_signal( "State",
self.cbIdleStateChanged )
+
+ self.inputnotifier_obj = self.bus.get_object(
"org.freesmartphone.odeviced", "/org/freesmartphone/Device/Input" )
+ self.inputnotifier_iface = Interface( self.inputnotifier_obj,
"org.freesmartphone.Device.Input" )
+ self.inputnotifier_iface.connect_to_signal( "Event", self.cbEvent )
+
+ print "displays:", self.fw.ListObjectsByInterface(
"org.freesmartphone.Device.Display" )
+ self.display_obj = self.tryGetProxy(
"org.freesmartphone.odeviced", self.fw.ListObjectsByInterface(
"org.freesmartphone.Device.Display" )[0] )
+ if self.display_obj is not None:
+ self.display_iface = Interface( self.display_obj,
"org.freesmartphone.Device.Display" )
+ self.display_iface.SetBrightness( 90 )
+ if self.device_obj is None:
+ failcount += 1
+ else:
+ print "device ok", self.device_iface
+
+ print "failcount=", failcount
+ if failcount == 0:
+ self.fullinit = True
+ return self.fullinit
+
+ def cbResourceChanged( self, resourcename ):
+ for cb in self.onResourceChanged:
+ cb( resourcename=resourcename )
+
+ def cbCallStatus( self, id, status, properties ):
+ print "CALL STATUS=", id, status, properties
+ if self.idlenotifier_iface is not None:
+ self.idlenotifier_iface.SetState("BUSY")
+ for cb in self.onCallStatus:
+ cb( id=id, status=status, properties=properties )
+
+ def cbNetworkStatus(self, status):
+ for cb in self.onNetworkStatus:
+ cb( status=status )
+
+ def cbIdleStateChanged( self, state ):
+ print "IDLE STATE=", state
+ for cb in self.onIdleStateChanged:
+ cb( state=state )
+ if state == "BUSY":
+ if self.display_iface is not None:
+ self.display_iface.SetBrightness( 90 )
+ elif state == "IDLE_DIM":
+ if self.display_iface is not None:
+ self.display_iface.SetBrightness( 20 )
+ elif state == "IDLE_PRELOCK":
+ if self.display_iface is not None:
+ self.display_iface.SetBrightness( 0 )
+
+ def cbEvent( self, name, action, seconds ):
+ print "INPUT EVENT=", name, action, seconds
+ if name+action == "AUXpressed":
+ # FIXME launch transition to main screen
+ pass
+ elif name+action == "POWERpressed":
+ # FIXME should the kernel filter out the button event that
triggerd the wakeup?
+ if self.ignoreSuspend: # we've just resumed
+ self.ignoreSuspend = False
+ return
+ self.ignoreSuspend = True
+ self.gsm_device_iface.PrepareForSuspend()
+ print "ENTERING SUSPEND"
+ os.system( "apm -s" )
+ print "RETURN FROM SUSPEND"
+ self.gsm_device_iface.RecoverFromSuspend()
+ self.idlenotifier_iface.SetState("BUSY")
+
+ def cbSignalStrength(self, strength):
+ for cb in self.onSignalStrength:
+ cb (strength = strength)
+ print 'SignalStrength:', strength
+
+
+def _test():
+ fso = FSOObject()
+ fso.initialize()
+
+
+if __name__ == '__main__':
+ _test()
Added: developers/john_lee/pyfso/general.py
===================================================================
--- developers/john_lee/pyfso/general.py (rev 0)
+++ developers/john_lee/pyfso/general.py 2008-07-15 14:03:32 UTC (rev
4527)
@@ -0,0 +1,39 @@
+from __future__ import with_statement
+from threading import RLock
+
+class Subject(object):
+ """implementation of the observer pattern. use _notify to notify all
+ observers about state change.
+ """
+ def __init__(self):
+ self._observers_lock = RLock()
+ self._observers = []
+
+ def attach(self, observer):
+ """attach as an observer
+ """
+ with self._observers_lock:
+ self._observers.append(observer)
+
+ def detach(self, observer):
+ """detach from observers
+ """
+ with self._observers_lock:
+ self._observers.remove(observer)
+
+ def _notify(self, *args, **kwargs):
+ with self._observers_lock:
+ for o in self._observers:
+ o.update(*args, **kwargs)
+
+
+class Singleton(object):
+ __single_lock = RLock()
+ __single = None
+ def __new__(cls, *args, **kwargs):
+ with cls.__single_lock:
+ if cls != type(cls.__single):
+ # subclass can create their own
+ cls.__single = object.__new__(cls, *args, **kwargs)
+ return cls.__single
+ #FIXME: the __init__ problem
--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog