Sunday, December 28, 2014

Saturday, December 27, 2014

Raspistill Instant Capture

If you run raspistill each time you want to take a shot, it does not work fast enough. In order to get instant shots it is much more useful to use the "signal mode".

In signal mode, raspistill waits for a SIGUSR1 signal from another process. You can invoke it like this:

raspistill -t 0 -s -o /tmp/shot.jpg

-s signal mode
-o output file
-t 0 disable default 5s timeout

and then when ready, send the signal to take a shot:

pkill -SIGUSR1 raspistill


pkill -10 raspistill

that's it.

* If you don't specify -t 0 parameter and disable default 5s timeout, raspistill will quit after 2 or 3 shots (actually will quit after spending total 5 seconds).

Sunday, October 26, 2014

Android Full Backup/Restore w/o Root

  • adb backup -apk -shared -all -f  BACKUP-apk-shared-all.ab
  • adb restore BACKUP-apk-shared-all.ab

Monday, September 29, 2014

Android Command Line Package Manager PM

  • The list of installed packages
# pm list packages

  • Uninstall package
# pm uninstall org.servalproject

Thursday, November 28, 2013

Android command line tips

Change screen resolution:
#am display-size 800x480

Connect WiFi network
> scan
> scan_results
> list_networks
> add_network
> set_network 0 ssid "MY_SSID"
> set_network 0 psk "MY_PSK"
> enable_network 0
> save_config
> ^D

Button press from command line!
# input keyevent 26
# input keyevent 4
# input keyevent 24
# input keyevent 25
# input keyevent 82
# input keyevent 84

Remount /system rw
# mount -o remount,rw -t ext4 /system 

Write and erase rockchip rk2928 nand partitions

#erase kernel
sudo rkflashtool e 0x00004000 0x00006000
#erase boot
sudo rkflashtool e 0x0000a000 0x00008000
#erase recovery
sudo rkflashtool e 0x00012000 0x00010000
#erase cache
sudo rkflashtool e 0x00042000 0x00040000
#erase userdata
sudo rkflashtool e 0x00082000 0x00200000
#erase system
sudo rkflashtool e 0x00100000 0x00284000
#erase misc
sudo rkflashtool e 0x00002000 0x00002000

#write kernel
sudo rkflashtool w 00004000 0x00006000 < kernel.img
#write boot
sudo rkflashtool w 0x0000a000 0x00008000 < boot.img
#write recovery
sudo rkflashtool w 0x00012000 0x00010000 < recovery.img
#write system
sudo rkflashtool w 0x00100000 0x00284000 < system.img
#write misc
sudo rkflashtool w 0x00002000 0x00002000 < misc.img

Rockchip unpack/repack boot.img

rkunpack boot.img
mkdir boot-extracted
cd boot-extracted
cat ../boot.img-raw | gunzip | cpio -i

find . | cpio -o -H newc | gzip > ../newboot.img
rkcrc -k newboot.img newboot-signed.img


dd if=boot.img of=boot.img.gz skip=8 bs=1 count=100000000000
gunzip boot.img.gz
mkdir unpacked
cd unpacked
cpio -i <../boot.img

cd unpacked
find . | xargs -I file touch -d "1970-01-01 01:00" file
find . | cpio -o -H newc | gzip -n >../newboot.img.gz
rkcrc -k newboot.img.gz newboot.img