<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>peterh - Linux - Blog</title>
		<link>http://www.holik.at/rss.php/index.php</link>
		<description><![CDATA[]]></description>
		<copyright>Copyright 2012, Peter Holik</copyright>
		<managingEditor>Peter Holik</managingEditor>
		<language>en-US</language>
		<generator>SPHPBLOG 0.7.0</generator>
		<item>
			<title>hdd performance tests</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry120130-101754</link>
			<description><![CDATA[#&gt; hdparm -tT /dev/sda<br />Timing buffered disk reads: 398 MB in  3.00 seconds = 132.45 MB/sec<br /><br />write:<br /><br />#&gt; dd if=/dev/zero of=./tempfile bs=1M count=1024 conv=fdatasync,notrunc<br />1073741824 Bytes (1,1 GB) kopiert, 12,8038 s, 83,9 MB/s  <br /><br />read:<br /><br />#&gt; echo 3 &gt; /proc/sys/vm/drop_caches<br />#&gt; dd if=./tempfile of=/dev/null bs=1M count=1024<br />1073741824 Bytes (1,1 GB) kopiert, 6,79724 s, 158 MB/s]]></description>
			<category>System, Debian/Ubuntu</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry120130-101754</guid>
			<author>Peter Holik</author>
			<pubDate>Mon, 30 Jan 2012 09:17:54 GMT</pubDate>
		</item>
		<item>
			<title>sftp and port forward only login</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry110916-103456</link>
			<description><![CDATA[I need a ssh login for restricted portforward but without a shell for the user.<br /><br />This got realized with /etc/ssh/sshd_config:<pre>...<br />Subsystem sftp internal-sftp<br /><br />Match user USER<br />  PasswordAuthentication yes<br />  AllowAgentForwarding no<br />  X11Forwarding no<br />  ForceCommand internal-sftp<br />  PermitOpen localhost:22<br />  ChrootDirectory /home/USER</pre><br />&quot;PermitOpen&quot;restricts portforward to localhost:22 (remote port forward is not restricted)<br /><br />But if the client needs a login shell this <b>failes</b>.<br /><br />Well you could tell the client to not use a login shell:<br /><br />ssh -N -L2222:IP:22 USER@SERVER<br /><br />putty: SSH / Protocol Option enable &quot;Don&#039;t start a shell or command at all&quot;<br /><br />or use an own loginshell where the user can only press return to disconnect:<br /><br />/etc/ssh/sshd_config:<pre>...<br />Subsystem sftp internal-sftp<br /><br />Match user USER<br />  PasswordAuthentication yes<br />  AllowAgentForwarding no<br />  X11Forwarding no<br />  PermitOpen 127.0.0.1:2222<br />  ChrootDirectory /home/USER</pre><br />sudo touch /home/USER/.hushlogin<br />sudo cp own_loginshell /home/USER/<br />/etc/passwd:USER:x:ID:ID::/:/own_loginshell<br /><br />own_loginshell.c:<pre>/*<br />   simple program to print to stdout and read from stdin without libc<br /><br />   taken from <a href="http://crazychenz.com/archives/107" >http://crazychenz.com/archives/107</a><br />   (http://stackoverflow.com/questions/2548486/compiling-without-libc)<br /><br />   modified 2011 by Peter Holik (peter@holik.at)<br /><br />   gcc -nostdlib -nostartfiles -fno-builtin own_loginshell.c -o own_loginshell<br />*/<br /><br />/* Types - I&#039;ve defined these just to match the kernel&#039;s macros, typedefs, and structs */<br />typedef unsigned int size_t;<br /><br />/* Syscalls */<br />exit(int error_code) {<br />        /* The asm call is a GCC thing that allows us to put assembly<br />         * inline with our C code. This particular use is the extended version,<br />         * which provides a very clean and easy way to map variables in<br />         * our code with registers in the assembly code.<br />         */<br />        asm(&quot;int  $0x80&quot;<br />            : // no output registers<br />            : &quot;a&quot; (1), &quot;b&quot; (error_code)<br />        );<br />}<br /><br />size_t read(unsigned int fd, char * buf, size_t count) {<br />        size_t ret;<br />        /* In this call, we have a return value, which know will be<br />         * of type size_t, so we put the value of %eax into ret.<br />         */<br />        asm(&quot;int  $0x80&quot;<br />            : &quot;=a&quot; (ret)<br />            : &quot;a&quot; (3), &quot;b&quot; (fd), &quot;c&quot; (buf), &quot;d&quot; (count)<br />        );<br />        return ret;<br />}<br /><br />size_t write(unsigned int fd, const char * buf, size_t count) {<br />        size_t ret;<br />        asm(&quot;int  $0x80&quot;<br />            : &quot;=a&quot; (ret)<br />            : &quot;a&quot; (4), &quot;b&quot; (fd), &quot;c&quot; (buf), &quot;d&quot; (count)<br />        );<br />        return ret;<br />}<br /><br />/* Notice that there is no main in this code, that is because<br /> * main is not _really_ required. All that is _really_ required<br /> * is the entry point for Linux to execute. I&#039;d suggest<br /> * always using a main() for compatibility reasons.<br /> */<br />void _start() {<br />        char *buf = &quot;press enter to close connection&quot;;<br /><br />        write(1, buf, 31);<br />        read(0, buf, 1);<br />        exit(0);<br />}</pre>]]></description>
			<category>System, Network, Debian/Ubuntu, Security, Programming</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry110916-103456</guid>
			<author>Peter Holik</author>
			<pubDate>Fri, 16 Sep 2011 08:34:56 GMT</pubDate>
		</item>
		<item>
			<title>change xorg screen dimension on login with xrandr</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry110907-162301</link>
			<description><![CDATA[* create modline setting with cvt for desired resolution<br /><br />* add new modline with xrandr --newmode<br /><br />* add mode to output with xrandr --addmode<br /><br />* set output and dimension with xrandr --output and --mode<br /><br />The needed steps are done in<br /><br />/etc/X11/Xsession.d/45custom_xrandr-settings<br /><pre><br /># $ cvt 1280 1024 60<br /># 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz<br /># Modeline &quot;1280x1024_60.00&quot;  109.00  1280 1368 1496 1712  1024 1027 1034 1063 \<br /># -hsync +vsync<br /># $ xrandr<br /># Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192<br /># HDMI-1 disconnected (normal left inverted right x axis y axis)<br /># VGA-1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm<br />#    1024x768       60.0* <br />#    800x600        60.3     56.2  <br />#    848x480        60.0  <br />#    640x480        59.9<br />xrandr --newmode &quot;1280x1024_60.00&quot;  109.00  1280 1368 1496 1712  1024 1027 1034 1063 \<br />-hsync +vsync<br />xrandr --addmode VGA-1 1280x1024_60.00<br /># $ xrandr<br /># Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192<br /># HDMI-1 disconnected (normal left inverted right x axis y axis)<br /># VGA-1 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm<br />#    1024x768       60.0* <br />#    800x600        60.3     56.2  <br />#    848x480        60.0  <br />#    640x480        59.9  <br />#    1280x1024_60.00   59.9<br />xrandr --output VGA-1 --mode 1280x1024_60.00</pre>]]></description>
			<category>System, Debian/Ubuntu</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry110907-162301</guid>
			<author>Peter Holik</author>
			<pubDate>Wed, 07 Sep 2011 14:23:01 GMT</pubDate>
		</item>
		<item>
			<title>usb modem dialin</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry110907-160416</link>
			<description><![CDATA[<b>Server</b><br /><br />needed packages: mgetty, pppd<br /><br />start and stop mgetty on plugin of usbmodem (0572:1329 Conexant Systems (Rockwell), Inc.)<br /><br />/etc/init/mgetty.conf<pre># mgetty - dialin daemon<br /><br />description     &quot;mgetty daemon&quot;<br /><br />start on tty-device-added KERNEL=ttyACM0<br />stop on tty-device-removed KERNEL=ttyACM0<br /><br />respawn<br />exec /sbin/mgetty -s 115200 -D /dev/ttyACM0</pre><br />/etc/mgetty/login.config<pre>/AutoPPP/ - a_ppp /usr/sbin/pppd auth +chap -pap name dialinserver remotename dialer debug</pre><br />I use chap instead of pap because of plain password used by pap.<br /><br />/etc/ppp/chap-secrets<pre>dialer dialinserver password *</pre><br />/etc/ppp/options.ttyACM0<pre>10.0.0.1:10.0.0.2</pre><br /><br /><b>Client</b><br /><br />needed packages: pppd<br /><br />/etc/ppp/peers/dialinserver<pre>noauth<br />connect &quot;/usr/sbin/chat -v -f /etc/chatscripts/dialinserver&quot;<br />debug<br />/dev/ttyS0<br />115200<br />defaultroute<br />noipdefault<br />name dialer<br />remotename dialinserver</pre><br />/etc/chatscripts/dialinserver<pre>ABORT BUSY ABORT &#039;NO CARRIER&#039; ABORT VOICE ABORT &#039;NO DIALTONE&#039; ABORT &#039;NO DIAL TONE&#039;<br />ABORT &#039;NO ANSWER&#039; ABORT DELAYED<br />&#039;&#039; ATZ<br />OK-AT-OK &quot;ATDTnumber&quot;<br />CONNECT \d\c</pre><br />/etc/ppp/chap-secrets<pre>dialer dialinserver password *</pre><br />Connect with &quot;pon dialinserver&quot; and disconnect with &quot;poff dialinserver&quot;]]></description>
			<category>System, Network, Debian/Ubuntu</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry110907-160416</guid>
			<author>Peter Holik</author>
			<pubDate>Wed, 07 Sep 2011 14:04:16 GMT</pubDate>
		</item>
		<item>
			<title>route icmp to a different gateway</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry110728-161709</link>
			<description><![CDATA[<pre>echo 100 icmp_route &gt;&gt; /etc/iproute2/rt_tables<br />ip rule add fwmark 1 table icmp_route<br />ip route add default via IP_OF_NOT_DEFAULT_GATEWAY dev eth0 table icmp_route<br /><br />iptables -t mangle -A OUTPUT -d IP_TO_PING -p icmp -j MARK --set-mark 1</pre>]]></description>
			<category></category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry110728-161709</guid>
			<author>Peter Holik</author>
			<pubDate>Thu, 28 Jul 2011 14:17:09 GMT</pubDate>
		</item>
		<item>
			<title>USB: uss720 fixup refcount position</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry110328-142436</link>
			<description><![CDATA[My testprog do a lot of bitbang - after hours i got following warning and my machine lockups:<br /><br />WARNING: at /build/buildd/linux-2.6.38/lib/kref.c:34<br /><br />After debugging uss720 driver i discovered that the completion callback was called before usb_submit_urb returns.<br />The callback frees the request structure that is krefed on return by usb_submit_urb.<br /><pre>--- a/drivers/usb/misc/uss720.c<br />+++ b/drivers/usb/misc/uss720.c<br />@@ -177,12 +177,11 @@ static struct uss720_async_request *submit_async_request(...<br />        spin_lock_irqsave(&amp;priv-&gt;asynclock, flags);<br />        list_add_tail(&amp;rq-&gt;asynclist, &amp;priv-&gt;asynclist);<br />        spin_unlock_irqrestore(&amp;priv-&gt;asynclock, flags);<br />+       kref_get(&amp;rq-&gt;ref_count);<br />        ret = usb_submit_urb(rq-&gt;urb, mem_flags);<br />-       if (!ret) {<br />-               kref_get(&amp;rq-&gt;ref_count);<br />+       if (!ret)<br />                return rq;<br />-       }<br />-       kref_put(&amp;rq-&gt;ref_count, destroy_async);<br />+       destroy_async(&amp;rq-&gt;ref_count);<br />        err(&quot;submit_async_request submit_urb failed with %d&quot;, ret);<br />        return NULL;<br /> }</pre><br /><a href="http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.38.y.git;a=commit;h=adaa3c6342b249548ea830fe8e02aa5b45be8688" >http://git.kernel.org/?p=linux/kernel/g ... 5b45be8688</a>]]></description>
			<category>Patches</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry110328-142436</guid>
			<author>Peter Holik</author>
			<pubDate>Mon, 28 Mar 2011 12:24:36 GMT</pubDate>
		</item>
		<item>
			<title>fast reboot with kexec</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry110304-151511</link>
			<description><![CDATA[sudo apt-get install kexec-tools<br /><br />change LOAD_KEXEC to true in /etc/default/kexec]]></description>
			<category>System, Debian/Ubuntu</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry110304-151511</guid>
			<author>Peter Holik</author>
			<pubDate>Fri, 04 Mar 2011 14:15:11 GMT</pubDate>
		</item>
		<item>
			<title>record a video with ffmpeg from a webcam with audio</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry110131-184951</link>
			<description><![CDATA[First activate and rise webcam audio input level with alsamixer.<br /><br />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]]></description>
			<category>System</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry110131-184951</guid>
			<author>Peter Holik</author>
			<pubDate>Mon, 31 Jan 2011 17:49:51 GMT</pubDate>
		</item>
		<item>
			<title>key remap on keyboard for console and X</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry110113-164527</link>
			<description><![CDATA[I got a funny viennese dialect keyboard, but after start using it i missed a key &#039;&lt;,&gt;,|&#039; :-(<br /><br />So i searched for a way to remap &#039;AltGr + y&#039; to &#039;|&#039;, &#039;AltGr + ,&#039; to &#039;&lt;&#039; and &#039;AltGr + .&#039; to &#039;&gt;&#039;<br /><br /><h2>Console</h2><br />evaluate the key to change with<br /><br />#&gt; sudo showkey -s<br /><br />press the key<br /><br />here y is 0x2c = 44<br />here , is 0x33 = 51<br />here . is 0x34 = 52<br /><br />test remap with<br /><br />echo &quot;altgr keycode 44 = bar&quot; | loadkeys<br /><br />bar is a symbolic name i found at <a href="http://www.linuxdocs.org/HOWTOs/German-HOWTO-5.html" >German-Howto</a><br /><br />Finally i extended <b>/etc/rc.local</b> with<br /><pre>LOADKEYS=$(which loadkeys)<br />if [ -x $LOADKEYS ]; then<br />  cat &lt;&lt; EOT | $LOADKEYS<br />altgr keycode 44 = bar<br />altgr keycode 51 = less<br />altgr keycode 52 = greater<br />EOT<br />  unset LOADKEYS<br />fi</pre><br /><h2>Xorg</h2><br /><br />evaluate the key to change with<br /><br />#&gt; xev<br /><br />press the key<br /><br />here y is keycode 52<br />here , is keycode 59<br />here . is keycode 60<br /><br />test remap with<br /><br />xmodmap -e &quot;keycode  52 = y Y y Y bar&quot;<br /><br />dump keys with<br /><br />#&gt; xmodmap -pke &gt; ~/.Xmodmap<br /><br />remove all lines except lines starting with desired keycodes to change.<br /><br />my <b>~/.Xmodmap</b> now looks like<br /><pre>keycode  52 = y Y y Y bar U203A guillemotright<br />keycode  59 = comma semicolon comma semicolon less multiply periodcentered<br />keycode  60 = period colon period colon greater division U2026</pre>]]></description>
			<category>System, Debian/Ubuntu</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry110113-164527</guid>
			<author>Peter Holik</author>
			<pubDate>Thu, 13 Jan 2011 15:45:27 GMT</pubDate>
		</item>
		<item>
			<title>Audio only capture from a video/audio usb capture stick</title>
			<link>http://www.holik.at/rss.php/index.php?entry=entry100427-184643</link>
			<description><![CDATA[#&gt; apt-get install xawtv<br /><br />I assume the usb stick become /dev/video0 and audio became card 1 (card 0 is an onboard audio device)<br /><br />#&gt; v4lctl -c /dev/video0 setattr input Composite1<br />#&gt; v4lctl -c /dev/video0 setattr mute off<br />#&gt; amixer -c 1 sset Line,0 50%,50% unmute cap<br /><br />test with:<br /><br />#&gt; arecord -D hw:1,0 -f S16_LE -c2 -r48000  | aplay<br /><br />To execute this commands automatically on plugin udev could be used:<br /><br />I have a cheap msi movie vox mini stick using em28xx driver with an option set:<br /><br />/etc/modprobe.d/local.conf<br /><pre>options em28xx card=38</pre><br />/etc/udev/rules.d/90-usbvideo.rules:<br /><pre>ACTION==&quot;add&quot;, KERNEL==&quot;video*&quot;, DRIVERS==&quot;usb&quot;, ATTRS{idVendor}==&quot;eb1a&quot;, ATTRS{idProduct}==&quot;2861&quot;, RUN+=&quot;/usr/bin/v4lctl -c /dev/%k setattr input Composite1&quot;                      <br />ACTION==&quot;add&quot;, KERNEL==&quot;video*&quot;, DRIVERS==&quot;usb&quot;, ATTRS{idVendor}==&quot;eb1a&quot;, ATTRS{idProduct}==&quot;2861&quot;, RUN+=&quot;/usr/bin/v4lctl -c /dev/%k setattr mute off&quot;                              <br />ACTION==&quot;add&quot;, KERNEL==&quot;video*&quot;, DRIVERS==&quot;usb&quot;, ATTRS{idVendor}==&quot;eb1a&quot;, ATTRS{idProduct}==&quot;2861&quot;, RUN+=&quot;/usr/bin/logger video init %k done&quot;                                       <br />ACTION==&quot;add&quot;, KERNEL==&quot;controlC[0-9]*&quot;, DRIVERS==&quot;usb&quot;, ATTRS{idVendor}==&quot;eb1a&quot;, ATTRS{idProduct}==&quot;2861&quot;, RUN+=&quot;/usr/bin/amixer -c %n sset Line,0 50%,50% unmute cap&quot;             <br />ACTION==&quot;add&quot;, KERNEL==&quot;controlC[0-9]*&quot;, DRIVERS==&quot;usb&quot;, ATTRS{idVendor}==&quot;eb1a&quot;, TTRS{idProduct}==&quot;2861&quot;, RUN+=&quot;/usr/bin/logger audio init card %n done&quot;</pre><br />v4lctl needs some time to finish, to check the settings use:<br /><br />v4lctl -c /dev/video0 show]]></description>
			<category>System</category>
			<guid isPermaLink="true">http://www.holik.at/rss.php/index.php?entry=entry100427-184643</guid>
			<author>Peter Holik</author>
			<pubDate>Tue, 27 Apr 2010 16:46:43 GMT</pubDate>
		</item>
	</channel>
</rss>

