User:Joerg rw/tools

(link sixwheeledb)
(proper bash and tools: /usr/bin/gnu/sed full path)
 
(27 intermediate revisions not shown)
Line 1: Line 1:
-
 
<s>All these hacks are tested on PR1.2(!!), but the cmdlines here are just off top of my head, so maybe typos or sth can be found. Lots of it will work on PR1.3 as well, but I haven't tested anything for PR1.3 yet.</s> "Tested" on CSSU-Tmaemo5.1
<s>All these hacks are tested on PR1.2(!!), but the cmdlines here are just off top of my head, so maybe typos or sth can be found. Lots of it will work on PR1.3 as well, but I haven't tested anything for PR1.3 yet.</s> "Tested" on CSSU-Tmaemo5.1
Please report on http://wiki.maemo.org/index.php?title=User_talk:Joerg_rw/tools&action=edit . Thanks!
Please report on http://wiki.maemo.org/index.php?title=User_talk:Joerg_rw/tools&action=edit . Thanks!
Line 6: Line 5:
=PRIOR TO FLASHING=
=PRIOR TO FLASHING=
 +
==Remove any SIM from phone!==
 +
see below for "cherry" compulsory SMS
==increase size of /home - if you like that==
==increase size of /home - if you like that==
If you feel like those 2GB /home (and /opt) are not enough for your zillion of apps you want to install and all the files you are used to keep in your $HOME, then you may want to patch eMMC aka *VANILLA* image file for '''larger /home partition''' (/opt is a bindmount to /home/opt, so this is also a way to have more free space to install apps)
If you feel like those 2GB /home (and /opt) are not enough for your zillion of apps you want to install and all the files you are used to keep in your $HOME, then you may want to patch eMMC aka *VANILLA* image file for '''larger /home partition''' (/opt is a bindmount to /home/opt, so this is also a way to have more free space to install apps)
Line 43: Line 44:
</pre>
</pre>
-
 
+
=The FLASHING=
 +
refer to http://wiki.maemo.org/Updating_the_tablet_firmware#The_Lazy_Approach
=AFTER FLASHING=
=AFTER FLASHING=
'''DO NOT install speedpatch, batterypatch, or auto-disconnect _ever_!! All three do not uninstall and do not work.  AdBlock will slow down browser to a grinding halt. If you're concerned about your privacy, do not insert SIM before you read about cherry below!'''
'''DO NOT install speedpatch, batterypatch, or auto-disconnect _ever_!! All three do not uninstall and do not work.  AdBlock will slow down browser to a grinding halt. If you're concerned about your privacy, do not insert SIM before you read about cherry below!'''
 +
==Replace Nokia core repos==
 +
Nokia's repo servers are down, so the very first "update" I suggest is clicking 
 +
 +
http://maemo.cloud-7.de/maemo5/et_al/HAM-catalogs/recommended.install
 +
==CSSU==
==CSSU==
<s>Actually recent switching to PR1.3 + Community-SSU resulted in a quite similar set of system properties. So most of the things below are not needed anymore, </s>except of course the gnu sanitizing of busybox crap.
<s>Actually recent switching to PR1.3 + Community-SSU resulted in a quite similar set of system properties. So most of the things below are not needed anymore, </s>except of course the gnu sanitizing of busybox crap.
Line 53: Line 60:
You did that? Fine, let's go on...
You did that? Fine, let's go on...
 +
 +
=="root" your device==
 +
open Hildon Application Manager also known as "Applications", and install [http://maemo.org/packages/package_instance/view/fremantle_extras_free_armel/rootsh/1.8/ rootsh] - or click [http://repository.maemo.org/extras/pool/fremantle/free/r/rootsh/rootsh_1.8_all.deb this link]
==Additional Repositories==
==Additional Repositories==
-
To make the plastic case melt and burn your fingers and your cat, click http://joerg.cloud-7.de/repositories.install (includes the catalogs aka repositories '''test, devel, and tools'''. Attention, will create dups, so check your '''catalog list''' in HAM anyway. You should keep all three catalogs usually disabled in HAM! Actually test and devel are mutually exclusive when you tink about it)
+
To make the plastic case melt and burn your fingers and your cat, click http://maemo.cloud-7.de/repositories.install (includes the catalogs aka repositories '''test, devel, and tools'''. Attention, will create dups, so check your '''catalog list''' in HAM anyway. You should keep all three catalogs usually disabled in HAM! Actually test and devel are '''mutually exclusive''' when you think about it, since test is a strict subset of devel)
 +
 
 +
'''NEVER do an apt-get upgrade or apt-get dist-upgrade, or in HAM never click "update all" when any of these repos is enabled!''' - it ''will'' ruin your system
=On Device=
=On Device=
Line 99: Line 111:
==proper '''bash and tools'''==
==proper '''bash and tools'''==
<pre>
<pre>
 +
# Hi <marius.vollmer@nokia.com>, I'm *not* a real hacker, I *do* read docs.
 +
# I wonder if everybody else on fremantle is a hacker except me
 +
cd /usr/sbin
 +
mv docpurge docpurge-disabled
 +
###ln -s /bin/true docpurge borked thanks messybox
 +
echo '#!/bin/sh' >docpurge
 +
chmod +x docpurge
 +
cd
 +
apt-get install bash3
apt-get install bash3
Line 104: Line 125:
# ~/.bashrc: executed by bash(1) for non-login shells.
# ~/.bashrc: executed by bash(1) for non-login shells.
-
PATH=/usr/bin/gnu:$PATH
+
PATH=$(echo $PATH \
 +
|/usr/bin/gnu/sed "s.:/usr/bin:.:/usr/bin/gnu:/usr/bin:.;s.:/usr/sbin:.:/usr/sbin/gnu:/usr/sbin:.")
 +
export PATH
 +
 
export PS1='\h:\w\$ '
export PS1='\h:\w\$ '
umask 022
umask 022
Line 111: Line 135:
export LS_OPTIONS='--color=auto'
export LS_OPTIONS='--color=auto'
#### for unclear reasons messybox feels obliged to source .bashrc >:-(
#### for unclear reasons messybox feels obliged to source .bashrc >:-(
-
#### so this will break the messy ls, and you'll need to use bash
+
#### so this will break the messy ls, and you'll need to use bash and proper coreutils-gnu ls
eval "`dircolors`"
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ls='ls $LS_OPTIONS'
Line 128: Line 152:
apt-get install coreutils-gnu
apt-get install coreutils-gnu
 +
apt-get install binutils  ;#strings etc
### breaks cssu-t5.1 MP, so it's commented out. Use on own peril:  
### breaks cssu-t5.1 MP, so it's commented out. Use on own peril:  
-
### apt-get install procps
+
### allegedly fixed in mp-fremantle-community-pr 21.2011.38-1Tmaemo11
 +
apt-get install procps
apt-get install less
apt-get install less
-
apt-get install findutils
+
apt-get install findutils-gnu
apt-get install locate
apt-get install locate
-
 
+
apt-get install sed-gnu
-
###obsolete since repo pkg fixed:
+
-
####patch updatedb to avoid borked messybox find:
+
-
###sed -i 's@{BINDIR}/find@{BINDIR}/gfind@' /usr/bin/gnu/updatedb
+
-
 
+
apt-get install man-db-n900
apt-get install man-db-n900
</pre>
</pre>
Line 166: Line 188:
##  OBSOLETE with CSSU, so now commented out #o#  #####
##  OBSOLETE with CSSU, so now commented out #o#  #####
# fix annoying hildon-desktop cpu hog bug
# fix annoying hildon-desktop cpu hog bug
-
## new: with ctrl-BS for nice taskswitching, see
 
-
## http://my.arava.co.il/~matan/repo/Modified_Hildon_Desktop.html
 
-
## and http://share.ovi.com/media/joerg900.screenshots/joerg900.10092 video
 
#o#cd ~user/MyDocs/tmp/
#o#cd ~user/MyDocs/tmp/
Line 182: Line 201:
#o#killall hildon-desktop
#o#killall hildon-desktop
 +
#
 +
# DESKTOP HOTKEYS
 +
#
 +
## new: with ctrl-BS for nice taskswitching, see
 +
## http://my.arava.co.il/~matan/repo/Modified_Hildon_Desktop.html
 +
## http://maemo.cloud-7.de/maemo5/media/Modified_Hildon_Desktop.html
 +
## and http://share.ovi.com/media/joerg900.screenshots/joerg900.10092 video
 +
## http://maemo.cloud-7.de/maemo5/media/MHD_demo_20090108_001.mp4
 +
#
# set ctl-BS to my preferred operation mode, '
# set ctl-BS to my preferred operation mode, '
 +
# ==================================
##    also for CSSU!!'  ##
##    also for CSSU!!'  ##
 +
#
#
# As it seems I haven't documented it elsewhere, here are the nifty  
# As it seems I haven't documented it elsewhere, here are the nifty  
Line 288: Line 318:
</pre>
</pre>
 +
===nasty hack to fix indicator light in bright environment===
 +
needs sed-gnu! https://talk.maemo.org/showthread.php?p=1388368
 +
<pre>
 +
od -A x -tx1 /usr/lib/mce/modules/libfilter-brightness-als.so \
 +
|grep '0086a0 05 00 00 00 05 00 00 00 00 00 00 00' \
 +
&& /usr/bin/gnu/sed -i -E \
 +
's/\x05\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00/\x05\x00\x00\x00\x05\x00\x00\x00\x05\x00\x00\x00/' \
 +
      /usr/lib/mce/modules/libfilter-brightness-als.so \
 +
&&od -A x -tx1 /usr/lib/mce/modules/libfilter-brightness-als.so \
 +
|grep '0086a0'
 +
###output should be:
 +
#0086a0 05 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00
 +
#0086a0 05 00 00 00 05 00 00 00 05 00 00 00 00 00 00 00
 +
</pre>
==tweaks (not only) for CSSU==
==tweaks (not only) for CSSU==
I currently updated to <s>16.5</s>CSSU-Tmaemo5.1.
I currently updated to <s>16.5</s>CSSU-Tmaemo5.1.
Line 296: Line 340:
</pre>
</pre>
 +
===get rid of the time&date dialog after battery swap===
 +
<pre>
 +
sudo mv /etc/X11/Xsession.d/30osso_startup_wizard /root/
 +
</pre>
===mediaplayer forgot how to play .ogg/.flac===
===mediaplayer forgot how to play .ogg/.flac===
tracker fixing index for .ogg:  
tracker fixing index for .ogg:  
-
sudo /var/lib/dpkg/info/decoders-support.postinst
+
<pre>sudo /var/lib/dpkg/info/decoders-support.postinst</pre>
-
 
+
===no autorotating===
===no autorotating===
Line 333: Line 380:
=backup=
=backup=
-
A job I start on my PC every day, via cron, like 'N900-rsync IroN900' (IroN900 is resolving to my N900's local IP in WLAN, via /etc/hosts. You as well can use a numerical IP). It automatically creates and keeps up-to-date a backup of N900's / (root) and /home/ (user data and opt). If my N900 is "not at home", the job will sleep until it becomes available again (I probably could handle better the rare case where I'm away for >24h, but it doesn't create too much trouble, just a bit of useless wlan traffic):
+
A job I start on my PC every day, via cron, like 'N900-rsync IroN900' (IroN900 is resolving to my N900's local IP in WLAN, via /etc/hosts. You as well can use a numerical IP). It automatically creates and keeps up-to-date a backup of N900's / (root) and /home/ (user data and opt). If my N900 is "not at home", the job will sleep until it becomes available again (I probably could handle better the rare case where I'm away for >24h, but it doesn't create too much trouble, just a bit of useless wlan traffic)
 +
For this job to work you need a working ssh-key setup that allows establishing ssh session without entering password! I.E. your PC user must have a private key in ~/.ssh/ and the matching public key must be in N900 ~root/.ssh/authorized_keys
<pre>
<pre>
#!/bin/sh
#!/bin/sh
Line 350: Line 398:
done
done
</pre>
</pre>
 +
 +
 +
=epilog=
 +
<inz> the world is a thin polished veil over a selection of nasty hacks, jury rigs, kludges, duct tape and wd-40
 +
 +
<enyc> inz: duct-tape is like the force:  dark on on side, light on the other, and holds the universe together

Latest revision as of 17:55, 23 January 2021

All these hacks are tested on PR1.2(!!), but the cmdlines here are just off top of my head, so maybe typos or sth can be found. Lots of it will work on PR1.3 as well, but I haven't tested anything for PR1.3 yet. "Tested" on CSSU-Tmaemo5.1 Please report on http://wiki.maemo.org/index.php?title=User_talk:Joerg_rw/tools&action=edit . Thanks!

Recommended links: http://wiki.maemo.org/User:Sixwheeledbeast/Scripts

Contents

PRIOR TO FLASHING

Remove any SIM from phone!

see below for "cherry" compulsory SMS

increase size of /home - if you like that

If you feel like those 2GB /home (and /opt) are not enough for your zillion of apps you want to install and all the files you are used to keep in your $HOME, then you may want to patch eMMC aka *VANILLA* image file for larger /home partition (/opt is a bindmount to /home/opt, so this is also a way to have more free space to install apps)

This is much easier than repartitioning the N900 *after* flashing. So if that's not obvious, this part is meant to be done on your linux desktop PC, prior to fresh full flash of N900:

NEW-HOME-SIZE=4096
# Size is in MB, tested up to 8192, changing number of chars known to 
# break things, so for 5digit values you might need more sophisticated edits.
# Theoretical limit ~28GB
sed -e "s/2048/$NEW-HOME-SIZE/" path/to/*VANILLA*.bin >patched-VANILLA.bin

the section in this image file is close to the head of file and looks like:

mmc {
        name = "internal";
        partition {
                fs_type = "vfat";
                prefix = "mydocs";
                no_create = true;
        }
        partition {
                size = 2048;
                fs_type = "ext3";
                prefix = "home";
        }
        partition {
                size = 768;
                fs_type = "swap";
        }
}

as this looks like a format free grammar, it's probably possible to "steal" whitespace from start of line to allow for 5 digit numbers . Something like:

sed -e "s/.size = 2048/size = 16192/" path/to/*VANILLA*.bin >patched-VANILLA.bin

The FLASHING

refer to http://wiki.maemo.org/Updating_the_tablet_firmware#The_Lazy_Approach

AFTER FLASHING

DO NOT install speedpatch, batterypatch, or auto-disconnect _ever_!! All three do not uninstall and do not work. AdBlock will slow down browser to a grinding halt. If you're concerned about your privacy, do not insert SIM before you read about cherry below!

Replace Nokia core repos

Nokia's repo servers are down, so the very first "update" I suggest is clicking

http://maemo.cloud-7.de/maemo5/et_al/HAM-catalogs/recommended.install

CSSU

Actually recent switching to PR1.3 + Community-SSU resulted in a quite similar set of system properties. So most of the things below are not needed anymore, except of course the gnu sanitizing of busybox crap.

So first install CSSU! http://wiki.maemo.org/Community_SSU

You did that? Fine, let's go on...

"root" your device

open Hildon Application Manager also known as "Applications", and install rootsh - or click this link

Additional Repositories

To make the plastic case melt and burn your fingers and your cat, click http://maemo.cloud-7.de/repositories.install (includes the catalogs aka repositories test, devel, and tools. Attention, will create dups, so check your catalog list in HAM anyway. You should keep all three catalogs usually disabled in HAM! Actually test and devel are mutually exclusive when you think about it, since test is a strict subset of devel)

NEVER do an apt-get upgrade or apt-get dist-upgrade, or in HAM never click "update all" when any of these repos is enabled! - it will ruin your system

On Device

The text below in the white boxes is intended to c&p to N900 xterm, or to a ssh session to N900 on your PC (all in a root account where not mentioned otherwise - first snippet takes care of this by the first line "root"). You should highlight a whole white box or at least a whole § beginning with ####line and insert the whole text as one chunk to your N900 or ssh remote terminal.

I took care about long lines by continuation\

marks\

so don't break up a block that consists of lines ending with \

Miniwrapper for apt-get logs.

root
cat >/usr/local/bin/apt-get <<"wikiETX"
#! /bin/sh
## file /usr/local/bin/apt-get
## due to $PATH will override original apt-get cmd and create
## a file installed-aps.sh in ~root/ which can be sourced to redo
## all the apps installed via `apt-get install <app>`

ag=/usr/bin/apt-get
case "$1" in
 "install")
    echo '############ logged install ###########'
    $ag "$@" && echo "$ag $@ ;#`date`" >>$HOME/installed-aps.sh
    ;;
 "dist-upgrade"|"autoremove")
    # autoremove kills rtcom-accounts-voip-support
    # see http://talk.maemo.org/showthread.php?t=70875
    echo "NONONO!! Don't do that!"
    exit 5
    ;;
 *)
    $ag "$@"
esac
wikiETX
chmod a+x /usr/local/bin/apt-get


proper bash and tools

# Hi <marius.vollmer@nokia.com>, I'm *not* a real hacker, I *do* read docs. 
# I wonder if everybody else on fremantle is a hacker except me
cd /usr/sbin
mv docpurge docpurge-disabled
###ln -s /bin/true docpurge borked thanks messybox
echo '#!/bin/sh' >docpurge
chmod +x docpurge
cd

apt-get install bash3

cat <<"wikietx" >/home/user/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.

PATH=$(echo $PATH \
|/usr/bin/gnu/sed "s.:/usr/bin:.:/usr/bin/gnu:/usr/bin:.;s.:/usr/sbin:.:/usr/sbin/gnu:/usr/sbin:.")
export PATH

export PS1='\h:\w\$ '
umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
#### for unclear reasons messybox feels obliged to source .bashrc >:-(
#### so this will break the messy ls, and you'll need to use bash and proper coreutils-gnu ls
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
#alias rm='rm -i'
#alias cp='cp -i'
#alias mv='mv -i'
wikietx

cp /home/user/.bashrc /root/

chown user /home/user/.bashrc

apt-get install coreutils-gnu
apt-get install binutils  ;#strings etc

### breaks cssu-t5.1 MP, so it's commented out. Use on own peril: 
### allegedly fixed in mp-fremantle-community-pr 21.2011.38-1Tmaemo11
apt-get install procps

apt-get install less
apt-get install findutils-gnu
apt-get install locate
apt-get install sed-gnu
apt-get install man-db-n900

random stuff to config / fix 'things' (c&p to shell)


###########################################
# disable annoying xchat notifications introduced with some more recent update
# goes along with 'undocumented' command /notify_mode -vl - thanks cehteh :-/
mv /usr/lib/xchat/plugins /usr/lib/xchat/plugins_disabled


###########################################
# master device name, replace "iroN900" by *your* favorite name
echo IroN900 >/etc/hostname


############################################ 
# kill that cherry PITA, before it sends SMS  --  STILL ACTUAL!
# see http://wiki.maemo.org/PR1.2_compulsory_My_Nokia_subscription
touch /home/user/.cherry_state


###########################################
##   OBSOLETE with CSSU, so now commented out #o#   #####
# fix annoying hildon-desktop cpu hog bug

#o#cd ~user/MyDocs/tmp/

##wget http://mohammadag.xceleo.org/repo/pool/\
##free/h/hildon-desktop/hildon-desktop_2.2.142-1_armel.deb
#o#wget http://my.svgalib.org/770/n900/hd-2.2.141/\
#o#modified-hildon-desktop_3.1_armel.deb

##dpkg -i hildon-desktop_2.2.142-1_armel.deb
#o#dpkg -i modified-hildon-desktop_3.1_armel.deb

#o#killall hildon-desktop

#
# DESKTOP HOTKEYS
#
## new: with ctrl-BS for nice taskswitching, see
## http://my.arava.co.il/~matan/repo/Modified_Hildon_Desktop.html
## http://maemo.cloud-7.de/maemo5/media/Modified_Hildon_Desktop.html
## and http://share.ovi.com/media/joerg900.screenshots/joerg900.10092 video
## http://maemo.cloud-7.de/maemo5/media/MHD_demo_20090108_001.mp4
#
# set ctl-BS to my preferred operation mode, '
# ==================================
##     also for CSSU!!'   ##

#
# As it seems I haven't documented it elsewhere, here are the nifty 
# keypress-sequences.
#      (C=control, B=backspace, Cd=control-press-and-hold, Cu=control-release)
# Cd,Bd = open taskswitcher; Bu,Bd = roll forward; Cu,Cd = roll-backward
# Bu,Cu = select upper leftmost / Cu,Bu = keep taskswitcher open
# with taskswitcher open: 
#  "q"|"w"|"e"\"a"|"s"|"f"... select app at that pos
#  Shift+"q"|"w"... close that app

gconftool-2 -s \
 /apps/osso/hildon-desktop/key-actions/ctrl_backspace_in_tasknav -t int 5

##   OBSOLETE with CSSU   #o# #####
#... and restore apt-get install (it's a metapkg, 
# so nothing bad seems to happen)
# might want to apt-get install it prior to next SSU to PR1.3
#o#apt-get remove mp-fremantle-generic-pr



###########################################
# fix NOPASSWD for root / sudo gainroot
# this will allow your N900 to ask for ROOT password on "root" 
# and "sudo gainroot" as it's supposed to be
# MAKE SURE YOU'VE SET PROPER ROOT PASSWORD PRIOR TO THIS! In expression
# type
    root
    passwd
#   exit
# and enter your root password two times, then (as root) do
sed -e "s/Defaults env_reset/Defaults env_reset\nDefaults targetpw/;\
 s+user ALL = NOPASSWD: /usr/sbin/gainroot+user ALL = PASSWD: /usr/sbin/gainroot+" \
 -i  /etc/sudoers.d/01sudo
update-sudoers
#this is how my 01sudo looks after the edit (excerpt):
# Defaults env_reset
# Defaults targetpw
# user ALL = PASSWD: /usr/sbin/gainroot
# user ALL = NOPASSWD: /usr/sbin/mmc-mount /dev/mmcblk0 /media/mmc1




###########################################
# nice trackerd, doesn't exactly make it bearable, but somewhat less sucking
sed -i -e "s/Throttle=0/Throttle=10/" /home/user/.config/tracker/tracker.cfg

###########################################
# "fix" the hold-key=sym nonsense
# http://wiki.maemo.org/Customizing_Maemo#Keyboard_Sym_on_auto_hold
gconftool-2 -s /apps/osso/inputmethod/ext_kb_repeat_enabled --type boolean true


###########################################
##   OBSOLETE with CSSU   #o######
# NK-Enter bug, putting less +/, htop "search", and many other back to proper
# https://bugs.maemo.org/show_bug.cgi?id=6009
## PR1.3: [2010-10-25 19:05:34] <agi> chem|st: seems to work just fine (re: libvte4)
#o#cd ~user/MyDocs/tmp/
#o#wget --no-check-certificate \
#o# https://bugs.maemo.org/attachment.cgi?id=2705 \
#o# -O libvte4_0.16.14-0mh9.m5_armel.deb
#o#dpkg -i libvte4_0.16.14-0mh9.m5_armel.deb


#!/bin/sh
# execute or source this to fix the missing end-times in eventslogger db
# thanks hcm @ http://talk.maemo.org/showpost.php?p=690253&postcount=20
## find original at http://maemo.cloud-7.de/maemo5/patches_n_tools/eventsdb_calllog_triggers.sh
sqlite3 -batch /home/user/.rtcom-eventlogger/el-v1.db <<ETX
DROP TRIGGER IF EXISTS call_duration_inbound;
CREATE TRIGGER call_duration_inbound AFTER UPDATE OF inbound_gsm ON call_duration FOR EACH ROW WHEN new.inbound_gsm > 0
BEGIN
	update events set end_time = (case when end_time=0 then start_time else end_time end) + ((select new.inbound_gsm) - (select old.inbound_gsm))
	where id = (select id from events where event_type_id = 1 and outgoing = 0 and service_id = 1 and local_uid='ring/tel/ring' order by start_time desc limit 1);
END;


DROP TRIGGER IF EXISTS call_duration_outbound;
CREATE TRIGGER call_duration_outbound AFTER UPDATE OF outbound_gsm ON call_duration FOR EACH ROW WHEN new.outbound_gsm > 0
BEGIN
	update events set end_time = (case when end_time=0 then start_time else end_time end) + ((select new.outbound_gsm) - (select old.outbound_gsm))
	where id = (select id from events where event_type_id = 1 and outgoing = 1 and service_id = 1 and local_uid='ring/tel/ring' order by start_time desc limit 1);
END;


DROP TRIGGER IF EXISTS call_duration_voip_in;
CREATE TRIGGER call_duration_voip_in AFTER UPDATE OF inbound_voip ON call_duration FOR EACH ROW WHEN new.inbound_voip > 0
BEGIN
	update events set end_time = (case when end_time=0 then start_time else end_time end) + ((select new.inbound_voip) - (select old.inbound_voip))
	where id = (select id from events where event_type_id = 1 and outgoing = 0 and service_id = 1 and local_uid!='ring/tel/ring' order by start_time desc limit 1);
END;


DROP TRIGGER IF EXISTS call_duration_voip_out;
CREATE TRIGGER call_duration_voip_out AFTER UPDATE OF outbound_voip ON call_duration FOR EACH ROW WHEN new.outbound_voip > 0
BEGIN
	update events set end_time = (case when end_time=0 then start_time else end_time end) + ((select new.outbound_voip) - (select old.outbound_voip))
	where id = (select id from events where event_type_id = 1 and outgoing = 1 and service_id = 1 and local_uid!='ring/tel/ring' order by start_time desc limit 1);
END;
ETX

nasty hack to fix indicator light in bright environment

needs sed-gnu! https://talk.maemo.org/showthread.php?p=1388368

od -A x -tx1 /usr/lib/mce/modules/libfilter-brightness-als.so \
|grep '0086a0 05 00 00 00 05 00 00 00 00 00 00 00' \
&& /usr/bin/gnu/sed -i -E \ 
's/\x05\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00/\x05\x00\x00\x00\x05\x00\x00\x00\x05\x00\x00\x00/' \
      /usr/lib/mce/modules/libfilter-brightness-als.so \
&&od -A x -tx1 /usr/lib/mce/modules/libfilter-brightness-als.so \
|grep '0086a0'
###output should be:
#0086a0 05 00 00 00 05 00 00 00 00 00 00 00 00 00 00 00
#0086a0 05 00 00 00 05 00 00 00 05 00 00 00 00 00 00 00

tweaks (not only) for CSSU

I currently updated to 16.5CSSU-Tmaemo5.1.

fix a bug that re-appears with each new CSSU upgrade:

apt-get install rtcom-accounts-voip-support 

get rid of the time&date dialog after battery swap

sudo mv /etc/X11/Xsession.d/30osso_startup_wizard /root/

mediaplayer forgot how to play .ogg/.flac

tracker fixing index for .ogg:

sudo /var/lib/dpkg/info/decoders-support.postinst

no autorotating

To get rid of the ubiquitous autorotating while still allowing dialer to switch to portrait mode (doesn't lock microB, for now I will live with it):

gconftool-2 --set /apps/osso/hildon-desktop/ui_can_rotate -t bool false
reboot


adjust drag&drop threshold

changing the drag&drop threshold, here to "100" (makes context menus disappear on stylus-up when too small):

sed -i "s/gtk-dnd-drag-threshold = [0-9]*/gtk-dnd-drag-threshold = 100/" \
/opt/usr/share/themes/*/gtk-2.0/gtkrc && /usr/bin/hildon-theme-recache-all
If you want to highlight single chars with stylus: pen-down and move >100 pixel (to avoid popup-menu), then reduce highlighted area again by moving tip of stylus towards point where you did pen-down.


replace shaking-hands video

/etc/X11/Xsession.d/10hildon_welcome = starter for video /opt/usr/share/hildon-welcome/media/Hands-v32-h264.avi = shaking-hands-video http://maemo.cloud-7.de/maemo5/bootvideo-DONTPANIC/ (the original author please holler - I forgot your name :-/ )

#replace Hands by DONT_PANIC! bootmovie
cd /opt/usr/share/hildon-welcome/media
wget http://maemo.cloud-7.de/maemo5/bootvideo-DONTPANIC/dontpanic.avi
#cp /etc/hildon-welcome.d/default.conf \
# /etc/hildon-welcome.d/default.conf_backup #makes BOTH videos play at boot :)
## to "uninstall" simply edit the file below 
## to read  "filename=Hands-v32-h264.avi"
echo -e "[hildon-welcome]\nfilename=dontpanic.avi" >/etc/hildon-welcome.d/default.conf

backup

A job I start on my PC every day, via cron, like 'N900-rsync IroN900' (IroN900 is resolving to my N900's local IP in WLAN, via /etc/hosts. You as well can use a numerical IP). It automatically creates and keeps up-to-date a backup of N900's / (root) and /home/ (user data and opt). If my N900 is "not at home", the job will sleep until it becomes available again (I probably could handle better the rare case where I'm away for >24h, but it doesn't create too much trouble, just a bit of useless wlan traffic) For this job to work you need a working ssh-key setup that allows establishing ssh session without entering password! I.E. your PC user must have a private key in ~/.ssh/ and the matching public key must be in N900 ~root/.ssh/authorized_keys

#!/bin/sh
## call with parameter <IP of maemo device to sync>
## NB this has a path relative to $HOME of user calling the job

while ! rsync -vaRzx --fake-super root@$1:/ ~/Documents/N900/backup/$1; do 
  echo "$1 not available via ssh, retrying in 30 minutes"; 
  sleep 1800; 
done
echo "########## rootfs synced, now syncing /home"

while ! rsync -vaRzx --fake-super root@$1:/home ~/Documents/N900/backup/$1/home; do 
  echo "$1 not available via ssh, retrying in 30 minutes"; 
  sleep 1800; 
done


epilog

<inz> the world is a thin polished veil over a selection of nasty hacks, jury rigs, kludges, duct tape and wd-40

<enyc> inz: duct-tape is like the force: dark on on side, light on the other, and holds the universe together