route icmp to a different gateway 
echo 100 icmp_route >> /etc/iproute2/rt_tables
ip rule add fwmark 1 table icmp_route
ip route add default via IP_OF_NOT_DEFAULT_GATEWAY dev eth0 table icmp_route

iptables -t mangle -A OUTPUT -d IP_TO_PING -p icmp -j MARK --set-mark 1


[ view entry ] ( 963 views )   |  print article
USB: uss720 fixup refcount position 
My testprog do a lot of bitbang - after hours i got following warning and my machine lockups:

WARNING: at /build/buildd/linux-2.6.38/lib/kref.c:34

After debugging uss720 driver i discovered that the completion callback was called before usb_submit_urb returns.
The callback frees the request structure that is krefed on return by usb_submit_urb.
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -177,12 +177,11 @@ static struct uss720_async_request *submit_async_request(...
spin_lock_irqsave(&priv->asynclock, flags);
list_add_tail(&rq->asynclist, &priv->asynclist);
spin_unlock_irqrestore(&priv->asynclock, flags);
+ kref_get(&rq->ref_count);
ret = usb_submit_urb(rq->urb, mem_flags);
- if (!ret) {
- kref_get(&rq->ref_count);
+ if (!ret)
return rq;
- }
- kref_put(&rq->ref_count, destroy_async);
+ destroy_async(&rq->ref_count);
err("submit_async_request submit_urb failed with %d", ret);
return NULL;
}

http://git.kernel.org/?p=linux/kernel/g ... 5b45be8688

[ view entry ] ( 1472 views )   |  print article
fast reboot with kexec 
sudo apt-get install kexec-tools

change LOAD_KEXEC to true in /etc/default/kexec

[ view entry ] ( 634 views )   |  print article
record a video with ffmpeg from a webcam with audio 
First activate and rise webcam audio input level with alsamixer.

ffmpeg -f video4linux2 -i /dev/video0 -pix_fmt yuv420p -s vga -r 8 -f alsa -ac 1 -ar 16000 -i hw:1,0 -vcodec mpeg4 -b 400k -acodec libmp3lame -ab 80k video.avi

[ view entry ] ( 983 views )   |  print article
key remap on keyboard for console and X 
I got a funny viennese dialect keyboard, but after start using it i missed a key '<,>,|' :-(

So i searched for a way to remap 'AltGr + y' to '|', 'AltGr + ,' to '<' and 'AltGr + .' to '>'

Console


evaluate the key to change with

#> sudo showkey -s

press the key

here y is 0x2c = 44
here , is 0x33 = 51
here . is 0x34 = 52

test remap with

echo "altgr keycode 44 = bar" | loadkeys

bar is a symbolic name i found at German-Howto

Finally i extended /etc/rc.local with
LOADKEYS=$(which loadkeys)
if [ -x $LOADKEYS ]; then
cat << EOT | $LOADKEYS
altgr keycode 44 = bar
altgr keycode 51 = less
altgr keycode 52 = greater
EOT
unset LOADKEYS
fi

Xorg



evaluate the key to change with

#> xev

press the key

here y is keycode 52
here , is keycode 59
here . is keycode 60

test remap with

xmodmap -e "keycode 52 = y Y y Y bar"

dump keys with

#> xmodmap -pke > ~/.Xmodmap

remove all lines except lines starting with desired keycodes to change.

my ~/.Xmodmap now looks like
keycode  52 = y Y y Y bar U203A guillemotright
keycode 59 = comma semicolon comma semicolon less multiply periodcentered
keycode 60 = period colon period colon greater division U2026


[ view entry ] ( 2263 views )   |  print article

<<First <Back | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Next> Last>>