Showing posts with label maemo. Show all posts
Showing posts with label maemo. Show all posts

Thursday, January 14, 2010

Avoiding "Size mismatch" Errors When Upgrading Maemo 5 Scratchbox

I have just returned to developing Maemo application, and as usual when I come back to my Maemo scratchbox installation, I start off by upgrading the development environment. So I opened my scratchbox and issued the commands
fakeroot apt-get update
fakeroot apt-get dist-upgrade
Unfortunately this did not work for me this time because of some inconsistencies in the index files kept at the Maemo servers (I think). I kept getting these "Failed to fetch http://someurl Size mismatch" errors. An example:
...
Failed to fetch http://repository.maemo.org/pool/maemo5.0/nokia-binaries/4bc37c7c77ebe90177c050b805a8dc79/nokia-binaries/h/hildon-application-manager-l10n/hildon-application-manager-l10n-plpl_6.0+r7389+0m5_all.deb Size mismatch
Failed to fetch http://repository.maemo.org/pool/maemo5.0/nokia-binaries/4bc37c7c77ebe90177c050b805a8dc79/nokia-binaries/h/hildon-application-manager-l10n/hildon-application-manager-l10n-ptpt_6.0+r7389+0m5_all.deb Size mismatch
Failed to fetch http://repository.maemo.org/pool/maemo5.0/nokia-binaries/4bc37c7c77ebe90177c050b805a8dc79/nokia-binaries/h/hildon-application-manager-l10n/hildon-application-manager-l10n-ruru_6.0+r7389+0m5_all.deb Size mismatch
Failed to fetch http://repository.maemo.org/pool/maemo5.0/nokia-binaries/4bc37c7c77ebe90177c050b805a8dc79/nokia-binaries/h/hildon-application-manager-l10n/hildon-application-manager-l10n-svse_6.0+r7389+0m5_all.deb Size mismatch
Failed to fetch http://repository.maemo.org/pool/maemo5.0/nokia-binaries/4bc37c7c77ebe90177c050b805a8dc79/nokia-binaries/h/hildon-theme-alpha/hildon-theme-alpha_9.1+0m5_all.deb Size mismatch
Failed to fetch http://repository.maemo.org/pool/maemo5.0/free/m/maemo-launcher/maemo-launcher_0.35-7+0m5_i386.deb Size mismatch
Failed to fetch http://repository.maemo.org/pool/maemo5.0/free/m/maemo-launcher/maemo-launcher-dev_0.35-7+0m5_all.deb Size mismatch
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
To avoid these errors I manually downloaded the packages involved and installed them with dpkg. To make this process easier I simply copied the error messages into a text file, removed the "Failed to fetch" prefix and the "Size mismatch" postfix from all lines using search/replace, and saved this as files.txt. Then I invoked the following commands from within my scratchbox targets:
cat files.txt | xargs wget
dpkg -i *.deb
And voila, it works ;-)

Tuesday, July 7, 2009

Scavenger demo application released!

I have just released the first Scavenger demo app: AugIM - the Augmented Image Manager. AugIM is an old demonstrator that I made a long time ago, and now I have ported it to use Scavenger for its cyber foraging tasks.


AugIM is an image browser/editor for Maemo (running on Nokia's N800/N810 devices) that allows you to do simple image manipulation tasks such as sharpening, resizing, adjusting color/contrast/brightness, rotating, flipping etc. It also allows you to share your images with the world through email or Google Picasa Web. The N800 and N810 devices are capable of performing these services on their own, but it takes a long time for them to do so and it consumes a very large amount of energy. Using Scavenger, AugIM makes sure that heavy processing is offloaded to larger surrogates whenever possible, which means that the image manipulation tasks are performed faster and using less energy on the mobile device.

Tuesday, March 31, 2009

Reading battery status on an N800/N810

For one of my projects I need to be able to read out the energy levels of the battery on my Nokia Internet Tablet (N810) - and I need to be able to do so from within a Python program, so that I may continuously monitor the energy usage of my program. After reading this blog post and talking to my friend Jussi, who had spent some days implementing such functionality in a C++ program of his, I spent about five minutes porting it to Python (thanks Jussi!). The result is shown below:

import dbus

bus = dbus.SystemBus()
hal_obj = bus.get_object ('org.freedesktop.Hal',
'/org/freedesktop/Hal/Manager')
hal = dbus.Interface (hal_obj, 'org.freedesktop.Hal.Manager')
uids = hal.FindDeviceByCapability('battery')
dev_obj = bus.get_object ('org.freedesktop.Hal', uids[0])

print 'charge level percentage',\
dev_obj.GetProperty('battery.charge_level.percentage')
print 'charge current', dev_obj.GetProperty('battery.reporting.current')
print 'charge design', dev_obj.GetProperty('battery.reporting.design')
print 'charge last full',\
dev_obj.GetProperty('battery.reporting.last_full')
print 'charge unit', dev_obj.GetProperty('battery.reporting.unit')
print 'voltage current', dev_obj.GetProperty('battery.voltage.current')
print 'voltage design', dev_obj.GetProperty('battery.voltage.design')
print 'voltage unit', dev_obj.GetProperty('battery.voltage.unit')

This little snippet of Python code talks to the HAL layer through D-Bus, and in that way is capable of coming up with quite a lot of information about the battery. Check the complete HAL battery API for more information about what can be read through these calls.