<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nattster &#187; ubuntu</title>
	<atom:link href="http://nattster.siamdev.net/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://nattster.siamdev.net</link>
	<description>ก็ชอบเขียนโปรแกรมอ่ะ...ผิดตรงไหน!?</description>
	<lastBuildDate>Tue, 01 Jun 2010 08:57:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://nattster.siamdev.net/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
<script type="text/javascript">
/* <![CDATA[ */
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>ทำให้ ADB มองเห็น WellcoM A88</title>
		<link>http://nattster.siamdev.net/2010/03/adb-wellcom-a88/</link>
		<comments>http://nattster.siamdev.net/2010/03/adb-wellcom-a88/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 09:15:11 +0000</pubDate>
		<dc:creator>nattster</dc:creator>
				<category><![CDATA[คอมพิวเตอร์จ๋า]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nattster.siamdev.net/?p=667</guid>
		<description><![CDATA[ADB = Android Debug Bridge เป็นโปรแกรมช่วยให้เรา เข้าไปที่ shell ของมือถือ/โอนไฟล์/ลงโปรแกรมผ่านสาย USB ได้ ADB รุ่นที่มีอยู่ตอนนี้ยังไม่ได้เพิ่ม vendor id ของ Wellcom เข้าไป มันเลยมองไม่เห็นโทรศัพท์ครับ  (แต่เห็น @jittat บอกว่าใน GIT เพิ่มแล้ว) เรามาดูวิธีเพิ่ม vendor id กันครับ ตั้งค่า udev (บน Linux) 1. สร้างไฟล์ /etc/udev/rules.d/51-android.rules มีเนื้อหาดังนี้ SUBSYSTEM==&#34;usb&#34;, SYSFS&#123;idVendor&#125;==&#34;0489&#34;, MODE=&#34;0666&#34;, SYMLINK+=&#34;android_adb&#34; 2. restart udev ด้วยคำสั่ง $ sudo service udev restart 3. เมื่อถอด/เสียบสาย USB กับมือถืออีกรอบแล้วจะปรากฏ /dev/android_adb ขึ้นมา [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://nattster.siamdev.net/wp-content/uploads/2010/03/190320101359.resized.jpg" title="Wellcom A88" rel="lightbox[667]"><img class="alignleft size-thumbnail wp-image-683" title="Wellcom A88" src="http://nattster.siamdev.net/wp-content/uploads/2010/03/190320101359.resized-150x150.jpg" alt="" width="150" height="150" /></a> ADB = Android Debug Bridge เป็นโปรแกรมช่วยให้เรา เข้าไปที่ shell ของมือถือ/โอนไฟล์/ลงโปรแกรมผ่านสาย USB ได้</p>
<p>ADB รุ่นที่มีอยู่ตอนนี้ยังไม่ได้เพิ่ม vendor id ของ Wellcom เข้าไป มันเลยมองไม่เห็นโทรศัพท์ครับ  (แต่เห็น @jittat บอกว่าใน GIT เพิ่มแล้ว)</p>
<p>เรามาดูวิธีเพิ่ม vendor id กันครับ</p>
<p><span id="more-667"></span><br />
<h4>ตั้งค่า udev (บน Linux)</h4>
<p>1. สร้างไฟล์ <strong>/etc/udev/rules.d/51-android.rules</strong> มีเนื้อหาดังนี้</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SUBSYSTEM</span>==<span style="color: #ff0000;">&quot;usb&quot;</span>, SYSFS<span style="color: #7a0874; font-weight: bold;">&#123;</span>idVendor<span style="color: #7a0874; font-weight: bold;">&#125;</span>==<span style="color: #ff0000;">&quot;0489&quot;</span>, <span style="color: #007800;">MODE</span>=<span style="color: #ff0000;">&quot;0666&quot;</span>, SYMLINK+=<span style="color: #ff0000;">&quot;android_adb&quot;</span></pre></div></div>

<p>2. restart udev ด้วยคำสั่ง</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> service udev restart</pre></div></div>

<p>3. เมื่อถอด/เสียบสาย USB กับมือถืออีกรอบแล้วจะปรากฏ <strong>/dev/android_adb</strong> ขึ้นมา</p>
<h4>ทำให้ android sdk รู้จักมือถือตัวนี้ (บน Windows และ Linux)</h4>
<p>1. แก้ไฟล์</p>
<p><strong> บน Linux: </strong>~/.android/adb_usb.ini</p>
<p><strong> บน Windows: </strong>C:\Users\USERNAMEคุณ\.android\adb_usb.ini    (Windows 7 นะจ๊ะ)</p>
<p>2. เพิ่ม <strong>0&#215;0489</strong> ที่บรรทัดสุดท้าย จะได้ไฟล์ที่มีหน้าตาประมาณนี้</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.</span>
<span style="color: #666666; font-style: italic;"># USE 'android update adb' TO GENERATE.</span>
<span style="color: #666666; font-style: italic;"># 1 USB VENDOR ID PER LINE.</span>
0x0489</pre></div></div>

<p>3. ลอง restart adb server และลองเรียกคำสั่ง adb devices จะเจออุปกรณ์ดังภาพ (เรียกจาก path ที่แตกไฟล์ android-sdk-linux_86/tools ไว้นะครับ)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ .<span style="color: #000000; font-weight: bold;">/</span>adb kill-server
$ .<span style="color: #000000; font-weight: bold;">/</span>adb devices
<span style="color: #000000; font-weight: bold;">*</span> daemon not running. starting it now <span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #000000; font-weight: bold;">*</span> daemon started successfully <span style="color: #000000; font-weight: bold;">*</span>
List of devices attached
FA1MAUS0002987	device    <span style="color: #000000; font-weight: bold;">&amp;</span>lt;-- นู๋ Wellcom A88 มาแล้วๆ</pre></div></div>

<p>สำหรับมือถือ android ยี่ห้ออื่นๆ ที่ adb หาไม่เจอ ผมคิดว่าใช้วิธีเดียวกันได้ โดยเปลี่ยน 0489 เป็น vendor id ที่ถูกต้อง (ใช้คำสั่ง lsusb ครับ)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ lsusb
Bus 001 Device 003: ID 046d:09b2 Logitech, Inc. Fujitsu Webcam
Bus 002 Device 011: ID 0489:c001 Foxconn <span style="color: #000000; font-weight: bold;">/</span> Hon Hai    <span style="color: #000000; font-weight: bold;">&amp;</span>lt;-- 0489 เป็น vendor <span style="color: #c20cb9; font-weight: bold;">id</span> ครับ
....</pre></div></div>

<p>ขอบคุณ: <a href="http://forum.archosfans.com/viewtopic.php?f=47&amp;t=26483&amp;start=20&amp;st=0&amp;sk=t&amp;sd=a">HOWTO: ADB support on Ubuntu Linux (on-device debugging!)</a> ที่ทำให้รู้จักไฟล์ adb_usb.ini</p>
]]></content:encoded>
			<wfw:commentRss>http://nattster.siamdev.net/2010/03/adb-wellcom-a88/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Ubuntu 3G ด้วย DTAC Aircard + Data Counter</title>
		<link>http://nattster.siamdev.net/2010/03/ubuntu-3g-data-counter/</link>
		<comments>http://nattster.siamdev.net/2010/03/ubuntu-3g-data-counter/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 04:46:53 +0000</pubDate>
		<dc:creator>nattster</dc:creator>
				<category><![CDATA[คอมพิวเตอร์จ๋า]]></category>
		<category><![CDATA[3g]]></category>
		<category><![CDATA[data counter]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nattster.siamdev.net/?p=654</guid>
		<description><![CDATA[วิธีตั้งค่า 1. ใส่ Sim card แล้วเสียบ Aircard เข้ากับคอม 2. รอ Aircard เชื่อมต่อเขากับเครือข่าย (ไฟกระพริบสีฟ้า) 3. ลอง lsusb จะเจอ Huawei Technologies Co., Ltd. E620 USB Modem 4. คลิกขวาที่ Network Manager เลือก Edit Connections&#8230; 5. คลิกที่ Tab Mobile Broadband กดปุ่ม Add 6. จะปรากฏหน้าต่างดังนี้ เลือก Device เป็น HUAWEI Technology HUAWEI Mobile แล้วกด Forward 7. เลือก Thailand กด Forward อีกรอบ [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://nattster.siamdev.net/wp-content/uploads/2010/03/2010-03-10-18.18.58.jpg" title="2010-03-10 18.18.58" rel="lightbox[654]"><img src="http://nattster.siamdev.net/wp-content/uploads/2010/03/2010-03-10-18.18.58.jpg" alt="" title="2010-03-10 18.18.58" width="150" height="175" class="alignleft size-full wp-image-662" /></a></p>
<h3>วิธีตั้งค่า</h3>
<p>1. ใส่ Sim card แล้วเสียบ Aircard เข้ากับคอม<br />
2. รอ Aircard เชื่อมต่อเขากับเครือข่าย (ไฟกระพริบสีฟ้า)<br />
3. ลอง lsusb จะเจอ Huawei Technologies Co., Ltd. E620 USB Modem<br />
4. คลิกขวาที่ Network Manager เลือก Edit Connections&#8230;<br />
<span id="more-654"></span><br />
<a href="http://nattster.siamdev.net/wp-content/uploads/2010/03/step1.png" title="step1" rel="lightbox[654]"><img src="http://nattster.siamdev.net/wp-content/uploads/2010/03/step1.png" alt="" title="step1" width="326" height="156" class="aligncenter size-full wp-image-658" /></a><br />
5. คลิกที่ Tab Mobile Broadband กดปุ่ม Add<br />
6. จะปรากฏหน้าต่างดังนี้ เลือก Device เป็น HUAWEI Technology HUAWEI Mobile แล้วกด Forward<br />
<a href="http://nattster.siamdev.net/wp-content/uploads/2010/03/step2.png" title="step2" rel="lightbox[654]"><img src="http://nattster.siamdev.net/wp-content/uploads/2010/03/step2-300x204.png" alt="" title="step2" width="300" height="204" class="aligncenter size-medium wp-image-659" /></a><br />
7. เลือก Thailand กด Forward อีกรอบ<br />
8. เลือก I can&#8217;t find my provider&#8230; แล้วตั้งชื่อ เช่น i-mobile 3GX แล้วก็กด Forward<br />
9. กำหนด APN (Access Point Name) ของเครือข่ายผมใช้ Internet แล้วก็กด Forward<br />
10. กด Apply อีก 2 ครั้ง<br />
11. ตอนนี้เวลาคลิกที่ไอคอน Network Manager จะปรากฏรายชื่อเครือข่าย Mobile Broadband ให้คลิกเพื่อเชื่อมต่อได้แล้วครับ<br />
<a href="http://nattster.siamdev.net/wp-content/uploads/2010/03/step3.png" title="step3" rel="lightbox[654]"><img src="http://nattster.siamdev.net/wp-content/uploads/2010/03/step3-300x203.png" alt="" title="step3" width="300" height="203" class="aligncenter size-medium wp-image-660" /></a></p>
<h3>ปัญหาที่เจอ</h3>
<p>	เวลาใช้บน Ubuntu เราไม่มีโปรแกรมช่วยต่อแบบบน Windows ตัว Aircard เลยเลือกเชื่อมต่อเครือข่ายที่สัญญาณแรงที่สุด แถวหอผม สัญญาณ TOT 3G บางทีก็เบา ตัว Aircard มันก็เลยต่อ AIS GSM ให้ พอ connect ปั๊บก็ใช้เน็ตไม่ได้ เพราะผิดเครือข่าย<br />
	วิธีแก้คือ Disconnect แล้วก็ถอด/เสีย Aircard ใหม่อีกรอบครับ</p>
<h3>Data Counter สำหรับ Ubuntu</h3>
<p>	คนใช้ 3G ทุกคนคงต้องกังวลเรื่อง Bandwidth (ปริมาณข้อมูลที่รับส่งในแต่ละเดือน) บน Ubuntu สามารถดูปริมาณอัพโหลด/ดาวน์โหลดได้ด้วยคำสั่ง ifconfig ppp0 ดังนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ifconfig</span> ppp0</pre></div></div>

<p>แต่ถ้าต้องนั่งจดเองทุกครั้งที่ต่อเน็ต ก็คงเหนื่อยเนาะครับ (ผมทำอยู่เดือนนึง หะๆ)</p>
<p>ผมเลยเขียน script เล็กๆ ไปฝากไว้เป็น Network Manager dispatcher ช่วยเก็บ log bandwidth ให้อัตโนมัติทุกครั้งที่ disconnect ครับ</p>
<p>สร้างไฟล์ 02datacounter ไว้ที่ /etc/NetworkManager/dispatcher.d / ให้มีเนื้อหาดังนี้<br />
ใช้คำสั่ง</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>NetworkManager<span style="color: #000000; font-weight: bold;">/</span>dispatcher.d<span style="color: #000000; font-weight: bold;">/</span>02datacounter</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash </span>
<span style="color: #007800;">IF</span>=$<span style="color: #000000;">1</span> 
<span style="color: #007800;">STATUS</span>=$<span style="color: #000000;">2</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$IF</span>&quot;</span> = <span style="color: #ff0000;">&quot;ppp0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS</span>&quot;</span> = <span style="color: #ff0000;">&quot;down&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> 
        <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>messages <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'pppd.*Sent.*received'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>nattster<span style="color: #000000; font-weight: bold;">/</span>logs<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>b<span style="color: #000000; font-weight: bold;">`</span>.txt 
    <span style="color: #000000; font-weight: bold;">fi</span> 
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>Script ข้างบนจะเก็บ log ไว้ในโฟลเดอร์ /home/nattster/logs/ ครับ โดยแยกตามเดือน เช่น Jan.txt, Feb.txt, Mar.txt, …</p>
<p>สร้างไฟล์ /home/nattster/logs/report.py มีเนื้อหาตามนี้ครับ (ใช้วิเคราะห์ log สร้างรายงานการใช้ bandwidth)</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># by Natt Piyapramote (@nattster)</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">glob</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> analyze<span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span>:
	p = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'([A-Za-z]+ [ 0-9]+) .* Sent (.*) bytes, received (.*) bytes.'</span><span style="color: black;">&#41;</span>
&nbsp;
	f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>filename, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	m = p.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>f<span style="color: black;">&#41;</span>
&nbsp;
	bw = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
	sumbw = <span style="color: #ff4500;">0</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> m:
		day, up, down = x
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> bw.<span style="color: black;">has_key</span><span style="color: black;">&#40;</span>day<span style="color: black;">&#41;</span>:
			bw<span style="color: black;">&#91;</span>day<span style="color: black;">&#93;</span> = <span style="color: #ff4500;">0</span>
		bw<span style="color: black;">&#91;</span>day<span style="color: black;">&#93;</span> += <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>up<span style="color: black;">&#41;</span>+<span style="color: #008000;">int</span><span style="color: black;">&#40;</span>down<span style="color: black;">&#41;</span>
		sumbw += <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>up<span style="color: black;">&#41;</span>+<span style="color: #008000;">int</span><span style="color: black;">&#40;</span>down<span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> day <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">sorted</span><span style="color: black;">&#40;</span>bw.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'   %s bw = %.2f MB'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>day,<span style="color: black;">&#40;</span>bw<span style="color: black;">&#91;</span>day<span style="color: black;">&#93;</span>/<span style="color: #ff4500;">1024.0</span>/<span style="color: #ff4500;">1024.0</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">print</span> filename, <span style="color: #483d8b;">'Total = %.2f MB'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>sumbw/<span style="color: #ff4500;">1024.0</span>/<span style="color: #ff4500;">1024.0</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: #008000;">file</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">glob</span>.<span style="color: #dc143c;">glob</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'*.txt'</span><span style="color: black;">&#41;</span>:
	analyze<span style="color: black;">&#40;</span><span style="color: #008000;">file</span><span style="color: black;">&#41;</span></pre></div></div>

<p>เมื่อลองรันจะได้ผลลัพธ์ดังนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ python report.py 
   Mar  <span style="color: #000000;">1</span> bw = <span style="color: #000000;">75.78</span> MB
   Mar  <span style="color: #000000;">2</span> bw = <span style="color: #000000;">8.20</span> MB
   Mar  <span style="color: #000000;">3</span> bw = <span style="color: #000000;">81.57</span> MB
   Mar  <span style="color: #000000;">4</span> bw = <span style="color: #000000;">97.50</span> MB
   Mar  <span style="color: #000000;">5</span> bw = <span style="color: #000000;">1.85</span> MB
   Mar  <span style="color: #000000;">6</span> bw = <span style="color: #000000;">21.89</span> MB
   Mar  <span style="color: #000000;">7</span> bw = <span style="color: #000000;">41.43</span> MB
   Mar  <span style="color: #000000;">8</span> bw = <span style="color: #000000;">13.83</span> MB
   Mar  <span style="color: #000000;">9</span> bw = <span style="color: #000000;">100.00</span> MB
   Mar <span style="color: #000000;">10</span> bw = <span style="color: #000000;">3.77</span> MB
   Mar <span style="color: #000000;">11</span> bw = <span style="color: #000000;">77.11</span> MB
Mar.txt Total = <span style="color: #000000;">522.94</span> MB</pre></div></div>

<h3>หมายเหตุ:</h3>
<p>- อย่าลืมเปลี่ยน /home/nattster/ เป็น home directory ของคุณ หรือ path อื่นๆ ที่จะเก็บ log<br />
- แก้ ppp0 เป็นชื่อ interface ที่ถูกต้องด้วยนะครับ (ดูรายชื่อ interface ได้ด้วยคำสั่ง ifconfig ครับ)</p>
]]></content:encoded>
			<wfw:commentRss>http://nattster.siamdev.net/2010/03/ubuntu-3g-data-counter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a FTDI USB-to-Serial converter to work on Ubuntu 9.10</title>
		<link>http://nattster.siamdev.net/2010/02/getting-a-ftdi-usb-to-serial-converter-to-work-on-ubuntu-9-10/</link>
		<comments>http://nattster.siamdev.net/2010/02/getting-a-ftdi-usb-to-serial-converter-to-work-on-ubuntu-9-10/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 12:57:32 +0000</pubDate>
		<dc:creator>nattster</dc:creator>
				<category><![CDATA[คอมพิวเตอร์จ๋า]]></category>
		<category><![CDATA[ftdi]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[micropro]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://nattster.siamdev.net/?p=638</guid>
		<description><![CDATA[I bought a USB-to-Serial converter from ETTeam.com and test it with Ubuntu 9.10 (Karmic kernel 2.6.31-18-generic.) I&#8217;ve found that it doesn&#8217;t show as /dev/ttyUSB0 as other generic USB-to-Serial converter do. I&#8217;ve been googling for the solution for a while and found this bug report: ftdi serial driver broken in linux-image-2.6.31-14-generic (2.6.31-14.48) It said that the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.etteam.com/product/intf/et-usb-rs232-mini.jpg" width="200" align="left" style="padding: 5px;" /> I bought a USB-to-Serial converter from ETTeam.com and test it with Ubuntu 9.10 (Karmic kernel 2.6.31-18-generic.) I&#8217;ve found that it doesn&#8217;t show as /dev/ttyUSB0 as other generic USB-to-Serial converter do.<br />
<span id="more-638"></span><br />
I&#8217;ve been googling for the solution for a while and found this bug report: <a href="https://bugs.launchpad.net/ubuntu/+source/linux/+bug/460857">ftdi serial driver broken in linux-image-2.6.31-14-generic (2.6.31-14.48)</a><br />
It said that the fix is released with linux-kernel 2.6.32-13.18.</p>
<p>So I download a new 2.6.32 kernel package (.deb) from <a href="http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32.8/">Ubuntu&#8217;s kernel-ppa</a>. I installed these package with a command:</p>

<div class="wp_syntax"><div class="code"><pre class="generic" style="font-family:monospace;">sudo dpkg -i *.deb</pre></div></div>

<p>Now, I can load a ftdi_sio (FTDI Serial Input/Output) driver with a modprobe command. But it doesn&#8217;t recognize my device yet. I ran a <strong>lsusb</strong> command and found that my converter has a different Product ID. (It might be customized by ETTeam.com)</p>

<div class="wp_syntax"><div class="code"><pre class="generic" style="font-family:monospace;">$ lsusb
Bus 005 Device 005: ID 0403:e2e6 Future Technology Devices International, Ltd</pre></div></div>

<p>(0403 = vendor ID, e2e6 = product ID)</p>
<p>To get it work, I have to run the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="generic" style="font-family:monospace;">$ sudo modprobe ftdi_sio vendor=0x0403 product=0xe2e6</pre></div></div>

<p>Then I replug the converter and it is shown as /dev/ttyUSB0 now!</p>
]]></content:encoded>
			<wfw:commentRss>http://nattster.siamdev.net/2010/02/getting-a-ftdi-usb-to-serial-converter-to-work-on-ubuntu-9-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>OpenKiosk Extension : ตู้ประชาสัมพันธ์ง่ายๆ ด้วย Firefox</title>
		<link>http://nattster.siamdev.net/2009/10/openkiosk-firefox-extension/</link>
		<comments>http://nattster.siamdev.net/2009/10/openkiosk-firefox-extension/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 09:55:01 +0000</pubDate>
		<dc:creator>nattster</dc:creator>
				<category><![CDATA[คอมพิวเตอร์จ๋า]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[kiosk]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nattster.siamdev.net/?p=578</guid>
		<description><![CDATA[ไปแข่ง linux (NLC10 &#8211; การแข่งขันระบบปฏิบัติการลินุกซ์แห่งประเทศไทย) มา เขามีโจทย์ให้เลือก 5 ข้อ กลุ่มผมเลือกทำข้อง่ายสุดคือ &#8220;เตรียมเครื่อง linux สำหรับเป็นตู้ Interactive Kiosk สำหรับสนามบินแห่งชาติ&#8221; (ขอเรียก Interactive Kiosk สั้นๆ ว่า Kiosk ละกันนะครับ) ถ้างงว่าตู้ Kiosk คืออะไร ให้นึกถึงจอ Touchscreen ใหญ่ๆ ตามห้างครับ ที่เราเข้าไปจิ้มๆ หาข้อมูลได้ว่าร้านกระเป๋าหลุยส์ติงต๊อง อยู่ชั้นไหนโซนไหน จะได้เดินไปซื้อได้ถูก เจ้าจอ Touchscreen ใหญ่ๆ นี่แหละครับเรียกว่าตู้ Kiosk หรือตู้ประชาสัมพันธ์ คุณสมบัติที่สำคัญของตู้ Kiosk คือ ดูเว็บ/ใช้โปรแกรมประชาสัมพันธ์ได้อย่างเดียว ไม่มีสามารถหลบไปเล่นเกมกู้ระเบิด (Minesweeper), ถอดไพ่ (Solitare) หรือใช้งานโปรแกรมอื่นๆ ทำยังไงให้คอมธรรมดา กลายเป็นตู้ Kiosk ติดตั้ง ระบบปฏิบัติการตามใจชอบ จะ [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_580" class="wp-caption alignleft" style="width: 268px"><a href="http://nattster.siamdev.net/wp-content/uploads/2009/10/army.mil-35841-2009-04-22-150416.resized.jpg" title="ตัวอย่างตู้ Kiosk ของ US Army" rel="lightbox[578]"><img src="http://nattster.siamdev.net/wp-content/uploads/2009/10/army.mil-35841-2009-04-22-150416.resized-258x300.jpg" alt="ตัวอย่างตู้ Kiosk ของ US Army (ภาพจาก http://www.army.mil)" title="ตัวอย่างตู้ Kiosk ของ US Army" width="258" height="300" class="size-medium wp-image-580" /></a><p class="wp-caption-text">ตัวอย่างตู้ Kiosk ของ US Army (ภาพจาก http://www.army.mil)</p></div>ไปแข่ง linux <a href="http://nlc10.opentle.org/">(NLC10 &#8211; การแข่งขันระบบปฏิบัติการลินุกซ์แห่งประเทศไทย)</a> มา เขามีโจทย์ให้เลือก 5 ข้อ กลุ่มผมเลือกทำข้อง่ายสุดคือ &#8220;เตรียมเครื่อง linux สำหรับเป็นตู้ <a href="http://en.wikipedia.org/wiki/Interactive_kiosk#Internet_Kiosk">Interactive Kiosk</a> สำหรับสนามบินแห่งชาติ&#8221; (ขอเรียก Interactive Kiosk สั้นๆ ว่า Kiosk ละกันนะครับ)</p>
<h4>ถ้างงว่าตู้ Kiosk คืออะไร</h4>
<p>ให้นึกถึงจอ Touchscreen ใหญ่ๆ ตามห้างครับ ที่เราเข้าไปจิ้มๆ หาข้อมูลได้ว่าร้านกระเป๋าหลุยส์ติงต๊อง อยู่ชั้นไหนโซนไหน จะได้เดินไปซื้อได้ถูก เจ้าจอ Touchscreen ใหญ่ๆ นี่แหละครับเรียกว่าตู้ Kiosk หรือตู้ประชาสัมพันธ์</p>
<h4>คุณสมบัติที่สำคัญของตู้ Kiosk คือ</h4>
<p>ดูเว็บ/ใช้โปรแกรมประชาสัมพันธ์ได้อย่างเดียว ไม่มีสามารถหลบไปเล่นเกมกู้ระเบิด (Minesweeper), ถอดไพ่ (Solitare) หรือใช้งานโปรแกรมอื่นๆ</p>
<h4>ทำยังไงให้คอมธรรมดา กลายเป็นตู้ Kiosk</h4>
<ol>
<li>ติดตั้ง ระบบปฏิบัติการตามใจชอบ จะ Windows หรือ Linux ก็ได้</li>
<li>ติดตั้ง Mozilla Firefox, jsLib และ OpenKiosk จากเว็บ <a href="https://mozdevgroup.com/clients/bm/">Brooklyn Museum Kiosk Client</a></li>
<li>เมื่อติดตั้งเสร็จแล้วให้ปิด firefox แล้วเปิดจาก Command line ดังนี้ (เพื่อเปิดใช้ Kiosk แบบเต็มจอ)

<div class="wp_syntax"><div class="code"><pre class="generic" style="font-family:monospace;">mozilla -kiosk</pre></div></div>

</li>
<li>นอกจากนี้เรายังสามารถตั้งค่า Firefox ด้วย OpenKiosk ได้อีกมากมาย อ่านรายละเอียดได้จาก <a href="https://mozdevgroup.com/clients/bm/">https://mozdevgroup.com/clients/bm/</a> ครับ</li>
</ol>
<p>ตอนแข่งผมก็นั่งแก้ GUI ของ firefox เอง (firefox มันใช้ XUL ทำ GUI ครับ แก้ไขได้อิสระมากๆ) แต่พอค้นดีๆ เจอ OpenKiosk แล้ว โฮกกกก&#8230;. รู้งี้โหลดมาใช้ตั้งนานแล้ว</p>
]]></content:encoded>
			<wfw:commentRss>http://nattster.siamdev.net/2009/10/openkiosk-firefox-extension/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ล็อกอินเข้า Ubuntu ด้วยลายนิ้วมือ</title>
		<link>http://nattster.siamdev.net/2009/08/login-ubuntu-with-just-fingerprint/</link>
		<comments>http://nattster.siamdev.net/2009/08/login-ubuntu-with-just-fingerprint/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 15:10:20 +0000</pubDate>
		<dc:creator>nattster</dc:creator>
				<category><![CDATA[คอมพิวเตอร์จ๋า]]></category>
		<category><![CDATA[fingerprint]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nattster.siamdev.net/?p=509</guid>
		<description><![CDATA[เปลี่ยนมาใช้ Ubuntu ได้พักใหญ่ ไม่ค่อยได้สัมผัส fingerprint sensor ที่ติดมากับเครื่องเลย (เพราะไม่มีโปรแกรมที่ใช้มัน) ก่อนหน้านี้เคยโหลด fprint มาใช้ แต่มันไม่ค่อยเวิร์คตรงที่ ต้องพิมพ์ Username ก่อน แล้วสแกนนิ้ว (มันไม่สะดวกเลยแฮะ ต้องพิมพ์แล้วสแกน) วันนี้เลยลองค้นเน็ตใหม่อีกรอบ อยากได้โปรแกรมที่ แค่รูด ก็เปิดเครื่องได้ ก็ไปเจอ FingerprintGUI พอติดตั้ง (อย่างถูกวิธี)แล้ว ที่หน้าล็อกอินจะปรากฏหน้าต่างแบบนี้ แค่รูด ก็เปิดเครื่องได้&#8230;. เวิร์คเหมือนโปรแกรมบนวินโดวส์เลยครับ! (แต่รูปนิ้วอาจจะสวยไม่เท่า แค่นั้นเอง)]]></description>
			<content:encoded><![CDATA[<p>เปลี่ยนมาใช้ Ubuntu ได้พักใหญ่ ไม่ค่อยได้สัมผัส fingerprint sensor ที่ติดมากับเครื่องเลย (เพราะไม่มีโปรแกรมที่ใช้มัน)</p>
<p>ก่อนหน้านี้เคยโหลด <a href="http://reactivated.net/fprint/">fprint</a> มาใช้ แต่มันไม่ค่อยเวิร์คตรงที่ ต้องพิมพ์ Username ก่อน แล้วสแกนนิ้ว (มันไม่สะดวกเลยแฮะ ต้องพิมพ์แล้วสแกน)</p>
<p>วันนี้เลยลองค้นเน็ตใหม่อีกรอบ อยากได้โปรแกรมที่ <strong>แค่รูด ก็เปิดเครื่องได้</strong> ก็ไปเจอ <a href="http://www.n-view.net/Appliance/fingerprint/">FingerprintGUI</a></p>
<p>พอติดตั้ง (<a href="http://www.n-view.net/Appliance/fingerprint/Install-step-by-step.pdf">อย่างถูกวิธี</a>)แล้ว ที่หน้าล็อกอินจะปรากฏหน้าต่างแบบนี้<br />
<a href="http://nattster.siamdev.net/wp-content/uploads/2009/08/fingerprintgui.png" title="fingerprintgui" rel="lightbox[509]"><img src="http://nattster.siamdev.net/wp-content/uploads/2009/08/fingerprintgui.png" alt="fingerprintgui" title="fingerprintgui" width="357" height="127" class="aligncenter size-full wp-image-510" /></a></p>
<p>แค่รูด ก็เปิดเครื่องได้&#8230;. เวิร์คเหมือนโปรแกรมบนวินโดวส์เลยครับ! (แต่รูปนิ้วอาจจะสวยไม่เท่า แค่นั้นเอง)</p>
]]></content:encoded>
			<wfw:commentRss>http://nattster.siamdev.net/2009/08/login-ubuntu-with-just-fingerprint/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ดึง Rating &amp; Play Count จาก iTunes มาใส่ Rhythmbox</title>
		<link>http://nattster.siamdev.net/2009/07/sync-itunes-rhythmbox/</link>
		<comments>http://nattster.siamdev.net/2009/07/sync-itunes-rhythmbox/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 09:56:57 +0000</pubDate>
		<dc:creator>nattster</dc:creator>
				<category><![CDATA[คอมพิวเตอร์จ๋า]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[rhythmbox]]></category>
		<category><![CDATA[sync]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nattster.siamdev.net/?p=426</guid>
		<description><![CDATA[ผมใช้ iTunes ฟังเพลงมาปีกว่า (เอาไว้ใส่เพลงให้ iPod Shuffle) เวลาฟังเพลงผมก็ให้ดาว (Rating) กับเพลงที่ชอบ จะได้เลือกฟังเฉพาะเพลงที่ชอบได้ วิธีดึง Rating &#38; Play Count จาก iTunes มาใส่ Rhythmbox 1. ดึงเพลงที่มีใน iTunes มาใส่ใน Rhythmbox ให้หมด 2. รันสคริปต์ transferRatings (ดาวน์โหลดรุ่น 0.8.1) ดังนี้ python transferRatings-0.8.1.py &#91;path ไฟล์ iTunes Music Library.xml&#93; iTunes Music Library.xml อยู่ที่ไหน? Mac OS X: /Users/username/Music/iTunes/iTunes Music Library.xml Microsoft Windows: \Documents and Settings\username\My Documents\My Music\iTunes\iTunes [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://nattster.siamdev.net/wp-content/uploads/2009/07/itunes_rhythmbox1.png" title="itunes_rhythmbox" rel="lightbox[426]"><img class="alignleft size-thumbnail wp-image-428" title="itunes_rhythmbox" src="http://nattster.siamdev.net/wp-content/uploads/2009/07/itunes_rhythmbox1-150x150.png" alt="itunes_rhythmbox" width="150" height="150" /></a>ผมใช้ iTunes ฟังเพลงมาปีกว่า (เอาไว้ใส่เพลงให้ iPod Shuffle) เวลาฟังเพลงผมก็ให้ดาว (Rating) กับเพลงที่ชอบ จะได้เลือกฟังเฉพาะเพลงที่ชอบได้</p>
<h4>วิธีดึง Rating &amp; Play Count จาก iTunes มาใส่ Rhythmbox</h4>
<p>1. ดึงเพลงที่มีใน iTunes มาใส่ใน Rhythmbox ให้หมด<br />
2. รันสคริปต์ <a href="http://code.google.com/p/itunes-to-rhythmbox-ratings/">transferRatings</a> (<a href="http://itunes-to-rhythmbox-ratings.googlecode.com/files/transferRatings-0.8.1.py">ดาวน์โหลดรุ่น 0.8.1</a>)  ดังนี้</p>
<p><span id="more-426"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">python transferRatings-0.8.1.py <span style="color: #7a0874; font-weight: bold;">&#91;</span>path ไฟล์ iTunes Music Library.xml<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<h4>iTunes Music Library.xml อยู่ที่ไหน?</h4>
<blockquote><p><strong>Mac OS X:</strong><br />
/Users/username/Music/iTunes/iTunes Music Library.xml<br />
<strong>Microsoft Windows:</strong><br />
\Documents and Settings\username\My Documents\My Music\iTunes\iTunes Music Library.xml<br />
(อาจจะ Copy ไฟล์มาใส่ใน Linux Partition ก่อนก็ได้นะครับ)</p></blockquote>
<p>ถ้าขี้เกียจตามหา เราสามารถกด File->Export ใน iTunes ได้เลยครับ</p>
<h4>หมายเหตุ</h4>
<p>สคริปต์ transferRatings ยังสามารถ Sync ข้อมูลได้แบบทางเดียว คือ จาก iTunes ไป Rhythmbox ครับ</p>
<h4>References</h4>
<ol>
<li><a href="http://code.google.com/p/itunes-to-rhythmbox-ratings/">Google Project Hosting: itunes-to-rhythmbox-ratings</a></li>
<li><a href="http://support.apple.com/kb/HT1660">What are the iTunes library files?</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://nattster.siamdev.net/2009/07/sync-itunes-rhythmbox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ใส่ script ช่วยล็อกอินอัตโนมัติเวลาต่อเน็ต</title>
		<link>http://nattster.siamdev.net/2009/06/auto-login-script-hook/</link>
		<comments>http://nattster.siamdev.net/2009/06/auto-login-script-hook/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 16:41:57 +0000</pubDate>
		<dc:creator>nattster</dc:creator>
				<category><![CDATA[คอมพิวเตอร์จ๋า]]></category>
		<category><![CDATA[autologin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nontri]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nattster.siamdev.net/?p=339</guid>
		<description><![CDATA[ตั้งแต่ พรบ. คอมฯ ปี 50 ประกาศใช้ พวกเราผู้ใช้อินเตอร์เน็ตของหน่วยงานต่างๆ ก็คงจะคุ้นเคยกับหน้าจอ Login คล้ายๆ กับรูปทางซ้ายมือนี้ เรามาใส่ script ช่วยล็อกอินอัตโนมัติเวลาต่อ Wireless ติดกันดีกว่า (บล็อกนี้สำหรับผู้ใช้ Linux เท่านั้นครับ) &#8220;พอใช้ Script นี้เวลาเปิดเครื่องมา แล้วต่อ Wireless ติด มันก็ login ให้ทันทีครับ แล้วก็ login ซ้ำ เวลาต่อ Wireless อันใหม่ให้ด้วย!&#8221; &#8212; @nattster วิธีทำ 1. ที่ไดเร็กทอรี่ /etc/NetworkManager/dispatcher.d ให้สร้างไฟล์ 02autologin ครับ $ sudo gedit /etc/NetworkManager/dispatcher.d/02autologin 2. แปะโค้ดดังนี้ 1 2 3 4 5 6 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://nattster.siamdev.net/wp-content/uploads/2009/06/login1.png" title="หน้าจอ login แบบนี้" rel="lightbox[339]"><img src="http://nattster.siamdev.net/wp-content/uploads/2009/06/login1-150x150.png" alt="หน้าจอ login แบบนี้" title="หน้าจอ login แบบนี้" width="150" height="150" class="alignleft size-thumbnail wp-image-340" /></a> ตั้งแต่ พรบ. คอมฯ ปี 50 ประกาศใช้ พวกเราผู้ใช้อินเตอร์เน็ตของหน่วยงานต่างๆ ก็คงจะคุ้นเคยกับหน้าจอ Login คล้ายๆ กับรูปทางซ้ายมือนี้</p>
<p>เรามาใส่ script ช่วยล็อกอินอัตโนมัติเวลาต่อ Wireless ติดกันดีกว่า (บล็อกนี้สำหรับผู้ใช้ Linux เท่านั้นครับ)</p>
<blockquote><p>&#8220;พอใช้ Script นี้เวลาเปิดเครื่องมา แล้วต่อ Wireless ติด มันก็ login ให้ทันทีครับ แล้วก็ login ซ้ำ เวลาต่อ Wireless อันใหม่ให้ด้วย!&#8221; &#8212; @nattster</p></blockquote>
<p><span id="more-339"></span></p>
<h3>วิธีทำ</h3>
<p>1. ที่ไดเร็กทอรี่ /etc/NetworkManager/dispatcher.d ให้สร้างไฟล์ 02autologin ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>NetworkManager<span style="color: #000000; font-weight: bold;">/</span>dispatcher.d<span style="color: #000000; font-weight: bold;">/</span>02autologin</pre></div></div>

<p>2. แปะโค้ดดังนี้</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">IF</span>=$<span style="color: #000000;">1</span>
<span style="color: #007800;">STATUS</span>=$<span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATUS</span>&quot;</span> = <span style="color: #ff0000;">&quot;up&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$IF</span>&quot;</span> = <span style="color: #ff0000;">&quot;wlan0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>        <span style="color: #666666; font-style: italic;"># แก้ wlan0 เป็นชื่อการ์ด wireless หรือ lan ตามใจชอบ</span>
        <span style="color: #007800;">val</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>iwconfig <span style="color: #007800;">$IF</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">'ESSID:[^ ]*'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #007800;">essid</span>=<span style="color: #800000;">${val:7:$[${#val}</span>-<span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$essid</span> <span style="color: #000000; font-weight: bold;">in</span>
        truewifi<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            python <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>xxx<span style="color: #000000; font-weight: bold;">/</span>autologin1.py
            <span style="color: #000000; font-weight: bold;">;;</span>
        KUWIN<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            python <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>xxx<span style="color: #000000; font-weight: bold;">/</span>autologin2.py
            <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000; font-weight: bold;">esac</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>

<p>3. อย่าลืมแก้ <strong>wlan0</strong> ในบรรทัดที่ 5 เป็นชื่อการ์ด wireless หรือ lan ที่ต้องการให้ช่วย login อัตโนมัติด้วยนะครับ (เช่น eth0, eth1 เป็นต้น)<br />
4. Save และปิดไฟล์ แล้วเรียกคำสั่ง</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>NetworkManager<span style="color: #000000; font-weight: bold;">/</span>dispatcher.d<span style="color: #000000; font-weight: bold;">/</span>02autologin</pre></div></div>

<h3>Script นี้ทำไร?</h3>
<p>Script ข้างบน<strong>ยังทำงานไม่ได้</strong>นะครับ มันแค่ทำหน้าที่เช็คว่า <strong>&#8220;ถ้า wlan0 ถูกเชื่อมต่อกับ truewifi ให้รันสคริปต์ /home/xxx/autologin1.py ขึ้นทำงาน&#8221;</strong> เท่านั้นเองครับ</p>
<p>ถ้าจะให้มันทำงานได้จริงๆ ต้องไปหา(หรือเขียน) script autologin สำหรับอินเตอร์เน็ตแต่ละยี่ห้อนะครับ </p>
<p>ถ้าใช้เน็ตยี่ห้อเดียวกัน ติดต่อหลังไมค์ได้ครับ <img src='http://nattster.siamdev.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  (ตะโกนใส่ <a href="http://twitter.com/nattster">@nattster</a> ก็ได้ครับ)</p>
<p><em>หมายเหตุ: ทดลองบน Ubuntu 9.04 และใช้ Network Manager เป็นตัวจัดการ Wireless + LAN ครับ</em><br />
<strong>เพิ่มเติม: </strong> สำหรับคนใช้ ifconfig เป็นตัวจัดการเน็ตเวิร์ค (เช่น Ubuntu Server) สามารถใส่ script ไว้ที่ /etc/network/if-up.d/ ได้นะครับ ให้ผลลัพธ์เหมือนกัน</p>
]]></content:encoded>
			<wfw:commentRss>http://nattster.siamdev.net/2009/06/auto-login-script-hook/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ฟอนท์ Tahoma คมๆ บน Ubuntu</title>
		<link>http://nattster.siamdev.net/2009/06/sharp-font-on-ubuntu/</link>
		<comments>http://nattster.siamdev.net/2009/06/sharp-font-on-ubuntu/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 08:19:44 +0000</pubDate>
		<dc:creator>nattster</dc:creator>
				<category><![CDATA[คอมพิวเตอร์จ๋า]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nattster.siamdev.net/?p=281</guid>
		<description><![CDATA[อธิบายลักษณะฟอนท์ด้วยภาพ: ผมรู้สึกว่า Anti-alias กับ Font-hinting บน Ubuntu ทำให้หน้าเว็บภาษาไทยอ่านยาก ผมก็เลยเอา tahoma.ttf จาก Windows Vista (แท้นะจ๊ะ) มาใส่ไว้ที่ ~/.fonts/  (~/ คือ home directory มีความหมายคือ /home/nattster/ นะครับ) แล้วก็สร้างไฟล์ ~/.fonts.conf ตามคำแนะนำเรื่องฟอนท์ใน wiki ของ Ubuntu แต่ใน wiki เขาเขียน config สำหรับ font ไว้หลายตัวมากผมเลยตัดๆ config ทิ้งจนได้ ไฟล์ .fonts.conf (ของผม) ใครลองเอาไปใช้ได้ผลลัพธ์อย่างไร เล่าให้ฟังกันบ้างนะครับ หมายเหตุ: ผมต้องการเปิด Hinting กับ Anti-alias ตามปกติ แค่อยากปิด 2 ความสามารถนี้เมื่อฟอนท์มันเล็กเท่านั้นครับ]]></description>
			<content:encoded><![CDATA[<p>อธิบายลักษณะฟอนท์ด้วยภาพ:</p>
<p><a href="http://nattster.siamdev.net/wp-content/uploads/2009/06/font_before_after.png"><a href="http://nattster.siamdev.net/wp-content/uploads/2009/06/font_before_after.png" title="ก่อนและหลังแก้ .fonts.conf" rel="lightbox[281]"><img class="aligncenter size-full wp-image-291" title="ก่อนและหลังแก้ .fonts.conf" src="http://nattster.siamdev.net/wp-content/uploads/2009/06/font_before_after.png" alt="ก่อนและหลังแก้ .fonts.conf" width="581" height="113" style="border:1px solid #000;" /></a></a></p>
<p>ผมรู้สึกว่า Anti-alias กับ Font-hinting บน Ubuntu ทำให้หน้าเว็บภาษาไทยอ่านยาก ผมก็เลยเอา tahoma.ttf จาก Windows Vista (แท้นะจ๊ะ) มาใส่ไว้ที่ ~/.fonts/  (~/ คือ home directory มีความหมายคือ /home/nattster/ นะครับ)</p>
<p>แล้วก็สร้างไฟล์ ~/.fonts.conf ตามคำแนะนำเรื่อง<a href="https://wiki.ubuntu.com/Fonts#Font%20settings">ฟอนท์ใน wiki ของ Ubuntu</a> แต่ใน wiki เขาเขียน config สำหรับ font ไว้หลายตัวมากผมเลยตัดๆ config ทิ้งจนได้ <a href="http://nattster.siamdev.net/wp-content/uploads/2009/06/fonts.conf">ไฟล์ .fonts.conf (ของผม)</a> ใครลองเอาไปใช้ได้ผลลัพธ์อย่างไร เล่าให้ฟังกันบ้างนะครับ <img src='http://nattster.siamdev.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>หมายเหตุ: ผมต้องการเปิด Hinting กับ Anti-alias ตามปกติ แค่อยากปิด 2 ความสามารถนี้เมื่อฟอนท์มันเล็กเท่านั้นครับ</p>
]]></content:encoded>
			<wfw:commentRss>http://nattster.siamdev.net/2009/06/sharp-font-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
