<?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>憂藍夢境‧部落格 &#187; Linux</title>
	<atom:link href="http://blog.linym.net/archives/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.linym.net</link>
	<description>我的學習心得、筆記</description>
	<lastBuildDate>Fri, 09 Dec 2011 12:33:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>TwSMS 發簡訊 (Linux C 版)</title>
		<link>http://blog.linym.net/archives/216</link>
		<comments>http://blog.linym.net/archives/216#comments</comments>
		<pubDate>Sun, 20 Jan 2008 17:39:20 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[程式筆記]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[TwSMS]]></category>
		<category><![CDATA[傳簡訊]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/216</guid>
		<description><![CDATA[台灣簡訊(TwSMS)是國內一家線上傳簡訊的服務商，提供文字簡訊、語音簡訊等服務，價格也很合理，最重要的是有提供 API 介面，方便用戶在自己的程式中加入發送簡訊功能，官網已經有提供不少範例(PHP/ASP/JSP/Java/Perl/VB/BCB/Delphi)，這邊也有 Ruby 的版本，不過就是沒看到 C 的，所以大略寫了一個 Linux C 版本，打算加入自己的嵌入式專題使用。 TwSMS 提供的 API 很簡單，只要由 HTTP 對 API server 發送 Request 即可，接著 server 就會回傳結果。程式先建立一個 socket 連線，然後發送簡訊，最後再擷取回傳碼檢查是否成功。 #include &#60;stdio.h&#62; #include &#60;stdlib.h&#62; #include &#60;string.h&#62; #include &#60;sys/socket.h&#62; #include &#60;netinet/in.h&#62; #include &#60;arpa/inet.h&#62; #include &#60;netdb.h&#62; int main() { /* TWSMS 相關設定 */ char *username = &#34;username&#34;; // 帳號 char *password = [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.twsms.com/" target="_blank">台灣簡訊</a>(TwSMS)是國內一家線上傳簡訊的服務商，提供文字簡訊、語音簡訊等服務，價格也很合理，最重要的是有提供 API 介面，方便用戶在自己的程式中加入發送簡訊功能，官網已經有提供不少範例(PHP/ASP/JSP/Java/Perl/VB/BCB/Delphi)，<a href="http://github.com/cfc/twsmsr/tree/master" target="_blank">這邊</a>也有 Ruby 的版本，不過就是沒看到 C 的，所以大略寫了一個 Linux C 版本，打算加入自己的嵌入式專題使用。</p>
<p>TwSMS 提供的 API 很簡單，只要由 HTTP 對 API server 發送 Request 即可，接著 server 就會回傳結果。程式先建立一個 socket 連線，然後發送簡訊，最後再擷取回傳碼檢查是否成功。</p>
<pre title="code" class="cpp">

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;sys/socket.h&gt;
#include &lt;netinet/in.h&gt;
#include &lt;arpa/inet.h&gt;
#include &lt;netdb.h&gt;

int main()
{
	/* TWSMS 相關設定 */
	char *username = &quot;username&quot;;   // 帳號
	char *password = &quot;password&quot;; // 密碼
	char *type = &quot;now&quot;;         // 發送型態
	char *mobile = &quot;0912xxxxxx&quot;; // 電話
	char *message = &quot;簡訊測試&quot;; // 簡訊內容
	char *encoding = &quot;big5&quot;;    // 簡訊內容編碼
	char *popup = &quot;&quot;;          // 使用 POPUP 顯示
	char *mo = &quot;&quot;;             // 使用雙向簡訊
	char *vldtime = &quot;86400&quot;;    // 簡訊有效期限(秒)
	char *dlvtime = &quot;&quot;;         // 預約時間

	int sockfd;
	int len = 0;
	char *host = &quot;api.twsms.com&quot;;
	char msg[512], MSGData[512], buf[512];
	char *res, *checkRes;
	struct sockaddr_in address;
	struct hostent *hostinfo;

	bzero(&amp;address, sizeof(address));
	hostinfo = gethostbyname(host);
	if (!hostinfo) {
		fprintf(stderr, &quot;no host: %s\n&quot;, host);
		exit(1);
	}
	address.sin_family = AF_INET;
	address.sin_port = htons(80);
	address.sin_addr = *(struct in_addr *)*hostinfo-&gt;h_addr_list;

	/* Create socket */
	sockfd = socket(AF_INET, SOCK_STREAM, 0);

	/* Connect to server */
	if (connect(sockfd, (struct sockaddr *)&amp;address, sizeof(address)) == -1) {
		perror(&quot;connect faild!\n&quot;);
		exit(1);
	}

	/* Request string */
	len = snprintf(msg, 512,
				  &quot;username=%s&amp;password=%s&amp;type=%s&amp;encoding=%s&amp;popup=%s&amp;mo=%s&amp;mobile=%s&quot;
				  &quot;&amp;message=%s&amp;vldtime=%s&amp;dlvtime=%s&quot;, username, password, type, encoding,
				  popup, mo, mobile, message, vldtime, dlvtime);

	/* HTTP request content */
	snprintf(MSGData, 512,
			&quot;POST /send_sms.php HTTP/1.1\r\n&quot;
			&quot;Host: %s\r\n&quot;
			&quot;Content-Length: %d\r\n&quot;
			&quot;Content-Type: application/x-www-form-urlencoded\r\n&quot;
			&quot;Connection: Close\r\n\r\n&quot;
			&quot;%s\r\n&quot;, host, len, msg);

	/* Send message */
	send(sockfd, MSGData, strlen(MSGData), 0);

	/* Response message */
	recv(sockfd, buf, 512, 0);

	for (res = strtok(buf, &quot;\n&quot;); strncmp(res, &quot;resp&quot;, 4) != 0; res = strtok(NULL, &quot;\n&quot;));
	checkRes = strtok(res, &quot;=&quot;);
	checkRes = strtok(NULL, &quot;=&quot;);

	if (atoi(checkRes) &lt;= 0) {
		printf(&quot;傳送失敗\n&quot;);
	} else {
		printf(&quot;傳送完成\n&quot;);
	}

	close(sockfd);
	return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/216/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>開源中文語音合成:eSpeak</title>
		<link>http://blog.linym.net/archives/211</link>
		<comments>http://blog.linym.net/archives/211#comments</comments>
		<pubDate>Sat, 01 Dec 2007 00:47:20 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[軟體筆記]]></category>
		<category><![CDATA[eSpeak]]></category>
		<category><![CDATA[TTS]]></category>
		<category><![CDATA[語音合成]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/211</guid>
		<description><![CDATA[語音合成系統通常拿來做 TTS(Text to Speach) 應用，英文 TTS 已經滿多且成熟了，但是中文的目前大多是廠商或實驗室驗自行開發，所以可能沒辦法免費拿來研究。 最近發現的 eSpeak 這個 Open Source 已經在最新的開發版本中加入中文語音支援囉!網頁在這裡，應該不久就會變成正式版本釋出。根據了解，好用的 StarDict 翻譯軟體也是使用 eSpeak 來作為朗讀發音系統哦！ 在嘗試移植到嵌入式 ARM Linux 時失敗，因為實在太多 Shared Libraries 了，如果有成功的高手希望能分享一下心得。]]></description>
			<content:encoded><![CDATA[<p>語音合成系統通常拿來做 TTS(Text to Speach) 應用，英文 TTS 已經滿多且成熟了，但是中文的目前大多是廠商或實驗室驗自行開發，所以可能沒辦法免費拿來研究。</p>
<p>最近發現的 <a href="http://espeak.sourceforge.net/" target="_blank">eSpeak</a> 這個 Open Source 已經在最新的開發版本中加入中文語音支援囉!網頁在<a href="http://espeak.sourceforge.net/test/latest.html" target="_blank">這裡</a>，應該不久就會變成正式版本釋出。根據了解，好用的 <a href="http://stardict.sourceforge.net/" target="_blank">StarDict</a> 翻譯軟體也是使用 eSpeak 來作為朗讀發音系統哦！</p>
<p>在嘗試移植到嵌入式 ARM Linux 時失敗，因為實在太多 Shared Libraries 了，如果有成功的高手希望能分享一下心得。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/211/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>編譯 ZD1211 無線網卡驅動</title>
		<link>http://blog.linym.net/archives/209</link>
		<comments>http://blog.linym.net/archives/209#comments</comments>
		<pubDate>Mon, 19 Nov 2007 11:36:22 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[硬體筆記]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[wireless]]></category>
		<category><![CDATA[zd1211]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/209</guid>
		<description><![CDATA[關於如何編譯 ZD1211/ZD1211B 晶片的 USB 無線網卡 driver，經常在各大討論區及 BBS 看到有人提出相同的問題，因此來寫個教學。 前往 ZD1211 專案網站可以知道目前有三種版本的驅動，其中建議使用 zd1211rw 這個版本，因為它持續在更新且已納入 Linux 2.6.18 以後的 kernel 裡。zd1211rw 支援這三種晶片： ZyDAS ZD1211 ZyDAS ZD1211B Atheros AR5007UG 不過既然都已經納入 kernel 了為什麼還要編譯驅動？因為還是有很多產品的 USB ID 不能被 zd1211rw 所辨識(我的 PCI GW-US54GXS 就是)，當然就沒辦法驅動囉！這篇要做的就是從 kernel 裡的 zd1211rw source code 加入對應的 USB ID，主機環境是 ubuntu 7.10，其他版本應該也差不多。 首先要安裝編譯相關套件 &#038; 下載 linux source $ sudo apt-get install [...]]]></description>
			<content:encoded><![CDATA[<p>關於如何編譯 ZD1211/ZD1211B 晶片的 USB 無線網卡 driver，經常在各大討論區及 BBS 看到有人提出相同的問題，因此來寫個教學。</p>
<p>前往 <a href="http://zd1211.wiki.sourceforge.net/" target="_blank">ZD1211</a> 專案網站可以知道目前有三種版本的驅動，其中建議使用 <a href="http://www.linuxwireless.org/en/users/Drivers/zd1211rw" target="_blank">zd1211rw</a> 這個版本，因為它持續在更新且已納入 Linux 2.6.18 以後的 kernel 裡。zd1211rw 支援這三種晶片：</p>
<ul>
<li>ZyDAS ZD1211</li>
<li>ZyDAS ZD1211B</li>
<li>Atheros AR5007UG</li>
</ul>
<p>不過既然都已經納入 kernel 了為什麼還要編譯驅動？因為還是有很多產品的 USB ID 不能被 zd1211rw 所辨識(我的 PCI GW-US54GXS 就是)，當然就沒辦法驅動囉！這篇要做的就是從 kernel 裡的 zd1211rw source code 加入對應的 USB ID，主機環境是 ubuntu 7.10，其他版本應該也差不多。</p>
<p><strong>首先要安裝編譯相關套件 &#038; 下載 linux source</strong><br />
$ sudo apt-get install build-essential kernel-package linux-source</p>
<p><strong>切換至 src 目錄並解開 linux source</strong><br />
$ cd /usr/src<br />
$ sudo tar -xjvf linux-source-2.6.22.tar.bz2</p>
<p><strong>拷貝 kernel 設定檔(.config) 至 linux source</strong><br />
$ sudo cp linux-headers-2.6.22-14-generic/.config linux-source-2.6.22</p>
<p><strong>編輯 zd_usb.c 加入新 USB ID，可利用 lsusb 指令可以找出網卡的 ID，如：2019:5303</strong><br />
$ cd linux-source-2.6.22<br />
$ sudo vim drivers/net/wireless/zd1211rw/zd_usb.c<br />
在檔案開頭不遠處可以看到一堆 USB ID 號碼，就是要加進這裡面，GW-US54GXS 是 ZD1211B 晶片，所以在 ZD1211B 下方增加一行：<br />
/* ZD1211B */<br />
{ USB_DEVICE(0x2019, 0x5303), .driver_info = DEVICE_ZD1211B },<br />
確認後就存檔離開</p>
<p><strong>開始編譯驅動</strong><br />
$ sudo mkdir .tmp_versions<br />
$ sudo make drivers/net/wireless/zd1211rw/zd1211rw.ko</p>
<p><strong>沒錯誤就會產生 zd1211rw.ko，將它覆蓋原本系統中的</strong><br />
$ sudo cp drivers/net/wireless/zd1211rw/zd1211rw.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless/zd1211rw<br />
$ sudo depmod -a</p>
<p>重開機應該就可以正確驅動了:D</p>
<p>參考資料：<br />
<a href="http://www.linuxwireless.org/en/users/Drivers/zd1211rw/AddID" target="_blank">Adding new device IDs to zd1211rw</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/209/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Ubuntu 7.10 安裝心得</title>
		<link>http://blog.linym.net/archives/201</link>
		<comments>http://blog.linym.net/archives/201#comments</comments>
		<pubDate>Sat, 20 Oct 2007 18:19:36 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[系統]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/201</guid>
		<description><![CDATA[最新版的 Ubuntu 7.10 Gutsy Gibbon，終於在 2007 年 10 月 18 日下午正式發佈囉！這次沒聽說塞爆伺服器的情形發生了，大多順利下載完成，我也馬上拿出 NB 來全新安裝，裝完進到桌面的感想是：比以前更順了，安裝和使用大致上也沒什麼問題，不過筆電是 ATI X1450 的顯示晶片，要啟動 Compiz Fusion 特效還是麻煩了些。 一、啟動 Compiz Fusion 桌面特效 在新版中，如果顯卡驅動沒問題並且有支援，預設就會啟動特效，如果要手動更改可到 偏好設定 -> 外觀設定 -> Visual Effects 設定。 二、安裝 Compiz Fusion 管理工具 新版中設定 Compiz Fusion 特效要安裝 compizconfig-settings-manager，不要使用 gnome-compiz-manager (會不穩定)。 三、ATI 顯卡開啟特效 我是用 ATI Mobility Radeon X1450 的晶片，預設沒辦法開啟 Compiz Fusion，但安裝內建的驅動加上 xserver-xgl 套件即可。 但是裝了 [...]]]></description>
			<content:encoded><![CDATA[<p>最新版的 <a href="http://www.ubuntu.com/" target="_blank">Ubuntu 7.10 Gutsy Gibbon</a>，終於在 2007 年 10 月 18 日下午正式發佈囉！這次沒聽說塞爆伺服器的情形發生了，大多順利下載完成，我也馬上拿出 NB 來全新安裝，裝完進到桌面的感想是：比以前更順了，安裝和使用大致上也沒什麼問題，不過筆電是 ATI X1450 的顯示晶片，要啟動 Compiz Fusion 特效還是麻煩了些。</p>
<p><strong>一、啟動 Compiz Fusion 桌面特效</strong><br />
在新版中，如果顯卡驅動沒問題並且有支援，預設就會啟動特效，如果要手動更改可到 <em>偏好設定 -> 外觀設定 -> Visual Effects</em> 設定。</p>
<p><strong>二、安裝 Compiz Fusion 管理工具</strong><br />
新版中設定 Compiz Fusion 特效要安裝 compizconfig-settings-manager，不要使用 gnome-compiz-manager (會不穩定)。</p>
<p><strong>三、ATI 顯卡開啟特效</strong><br />
我是用 ATI Mobility Radeon X1450 的晶片，預設沒辦法開啟 Compiz Fusion，但安裝內建的驅動加上 xserver-xgl 套件即可。<br />
<a href='http://blog.linym.net/wp-content/uploads/2007/10/01jpg.jpg' title=''><img src='http://blog.linym.net/wp-content/uploads/2007/10/01jpg.jpg' alt='driver' width="500" /></a></p>
<p>但是裝了 xserver-xgl 之後，特效雖然開了，SCIM 輸入法卻也掛點了，完全沒辦法打中文，幸好 <a href="http://www.ubuntu.org.tw/modules/newbb/viewtopic.php?viewmode=flat&#038;type=&#038;topic_id=6465&#038;forum=2" target="_blank">Ubuntu 正體中文站</a> 有人找到了解決方法。<br />
選擇功能表 系統  -> 偏好設定 -> 作業階段 -> 初始啟動程式 -> 新增 -> 名稱（SCIM）→ 指令（scim) ，重新啟動即可。</p>
<p><del datetime="2007-10-27T16:48:16+00:00">ps. 據說官方即將釋出 8.42 驅動，預設就可以支援特效，敬請期待！</del><br />
<a href="http://ati.amd.com/support/drivers/linux/linux-radeon.html" target="_blank">8.42.3</a> 版的 Linux 驅動已釋出，但許多人試用的感想都不太理想，因此如果要開啟 compiz 特效，建議還是使用上面的方法。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/201/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 懶人包 - Lazybuntu 正式版發佈</title>
		<link>http://blog.linym.net/archives/199</link>
		<comments>http://blog.linym.net/archives/199#comments</comments>
		<pubDate>Sat, 20 Oct 2007 16:47:55 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[軟體筆記]]></category>
		<category><![CDATA[Lazybuntu]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[軟體]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/199</guid>
		<description><![CDATA[由 PCMan 所發起的 Ubuntu 懶人包 - Lazybuntu 終於正式發佈囉！剛好趕上 Ubuntu 7.10 的發行 ，正式版號為 0.1，強調 3個步驟，搞定你的 Ubuntu，Ubuntu 安裝完後，再使用 Lazybuntu，就能讓你的 Ubuntu 更好用，省去了麻煩的調校設定工作，值得 Ubuntu 新手或愛用者試試！]]></description>
			<content:encoded><![CDATA[<p>由 PCMan 所發起的 Ubuntu 懶人包 - <a href="http://lazybuntu.openfoundry.org/" target="_blank">Lazybuntu</a> 終於正式發佈囉！剛好趕上 <a href="http://releases.ubuntu.com/releases/7.10/" target="_blank">Ubuntu 7.10</a> 的發行 ，正式版號為 0.1，強調 <strong>3個步驟，搞定你的 Ubuntu</strong>，Ubuntu 安裝完後，再使用 <a href="http://lazybuntu.openfoundry.org/" target="_blank">Lazybuntu</a>，就能讓你的 Ubuntu 更好用，省去了麻煩的調校設定工作，值得 Ubuntu 新手或愛用者試試！<br />
<a href='http://blog.linym.net/wp-content/uploads/2007/10/lazybuntu_screenshot.png' title=''><img src='http://blog.linym.net/wp-content/uploads/2007/10/lazybuntu_screenshot.png' alt='Lazybuntu' width="500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/199/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>移植 Flite 到 ARM 平台</title>
		<link>http://blog.linym.net/archives/182</link>
		<comments>http://blog.linym.net/archives/182#comments</comments>
		<pubDate>Thu, 20 Sep 2007 17:09:41 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[arm]]></category>
		<category><![CDATA[flite]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/182</guid>
		<description><![CDATA[Flite (Festival-Lite) 是一套 TTS(Text To Speech) 系統，透過語音合成技術，不需要錄一堆龐大的語音資料庫就可以朗讀文句。Flite 顧名思義就是有名的 Festival 重寫精簡版，更適合應用在嵌入式系統上，編譯完的執行檔只有 2.5MB 左右，也由於是使用 C 寫的，所以可以很容易和自己的程式結合，試了半天總算可以在 2410 Arm Linux 上面跑起來了。 1. 跨平台編譯 編譯方式和大多數 Open Source 差不多。 # ./configure CC=arm-linux-gcc --host=arm-linux # make # arm-linux-strip bin/flite 完成就會得到 flite 執行檔，下載到板子測試： # flite -t &#34;Hello, How are you?&#34; 嗯，沒有聲音，只有第一次出現 0.x 秒的雜音，再試試： # flite &#34;Hello, How are you?&#34; test.wav 會將語音存成 test.wav，抓到 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.speech.cs.cmu.edu/flite/index.html" target="_blank">Flite</a> (Festival-Lite) 是一套 TTS(Text To Speech) 系統，透過語音合成技術，不需要錄一堆龐大的語音資料庫就可以朗讀文句。Flite 顧名思義就是有名的 <a href="http://www.cstr.ed.ac.uk/projects/festival/" target="_blank">Festival</a> 重寫精簡版，更適合應用在嵌入式系統上，編譯完的執行檔只有 2.5MB 左右，也由於是使用 C 寫的，所以可以很容易和自己的程式結合，試了半天總算可以在 2410 Arm Linux 上面跑起來了。</p>
<p><strong>1. 跨平台編譯</strong><br />
編譯方式和大多數 Open Source 差不多。<br />
# ./configure CC=arm-linux-gcc --host=arm-linux<br />
# make<br />
# arm-linux-strip bin/flite</p>
<p>完成就會得到 flite 執行檔，下載到板子測試：<br />
# flite -t &quot;Hello, How are you?&quot;<br />
嗯，沒有聲音，只有第一次出現 0.x 秒的雜音，再試試：<br />
# flite &quot;Hello, How are you?&quot; test.wav<br />
會將語音存成 test.wav，抓到 PC 上播放，很正常。所以猜想應該是放音部份的問題。</p>
<p><strong>2. 修改 src/audio/au_oss.c</strong><br />
覺得這一段怪怪的，因為記得 S3C2410 採用的 UDA1341 音效晶片只有 Ch1 和 Ch2<br />
    if (ad->channels == 0)<br />
	ad->channels = 1;<br />
改成<br />
    if (ad->channels == 1)<br />
	ad->channels = 2;<br />
重新編譯後再測試，有了，有聲音出來了，不過速度太快了，根本聽不清楚再唸什麼，所以要再改一下。</p>
<p><strong>3. 修改 lang/cmu_us_kal/cmu_us_kal.c</strong><br />
    /* Intonation */<br />
    feat_set_float(v->features,&quot;int_f0_target_mean&quot;,95.0); //音色<br />
    feat_set_float(v->features,&quot;int_f0_target_stddev&quot;,11.0); //音調<br />
    feat_set_float(v->features,&quot;duration_stretch&quot;,1.1);  //速度<br />
前兩個互相搭配可以調整出不同的聲音，實際測試結果發現在 ARM 平台及 PC 上播放會差滿多的，PC 上照預設值就很好聽，ARM 則是調整到下面這樣才比較能接受。<br />
    /* Intonation */<br />
    feat_set_float(v->features,&quot;int_f0_target_mean&quot;,167.0); //音色<br />
    feat_set_float(v->features,&quot;int_f0_target_stddev&quot;,65.0); //音調<br />
    feat_set_float(v->features,&quot;duration_stretch&quot;,2.5);  //速度</p>
<p>英文 TTS 差不多都已經滿純熟了，中文 TTS 不少業界或實驗室也都有不錯成果，不過都是要付費居多，如果是 Windows 則有微軟的 Speech SDK 可以使用。<br />
另外有找到 <a href="http://www.sounding.com.tw/modules/tinyd3/index.php?id=1" target="_blank">SD178A</a> 這顆 IC，應該是個不錯的東西。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/182/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在嵌入式 Linux 架設 Boa Webserver</title>
		<link>http://blog.linym.net/archives/180</link>
		<comments>http://blog.linym.net/archives/180#comments</comments>
		<pubDate>Tue, 18 Sep 2007 10:16:13 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[boa]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/180</guid>
		<description><![CDATA[Boa 是一套小型的網頁伺服器，很適合應用在 Embedded System 上，並且內建就可以直接支援以 C 寫的 CGI 網頁，這篇是移植 Boa 到 ARM9 S3C2410 平台的過程，Linux 版本為 2.6.17.4，使用 arm-linux toolchain 3.4.1 編譯。 1. 產生 Makefile 下載 Source code 並解壓縮進到 src 目錄。 # ./configure --host=arm-linux 2. 修改 Makefile 使用跨平台編譯 CC = arm-linux-gcc CPP = arm-linux-gcc -E # make (如果編譯或執行時有錯誤請看Q&#038;A) # arm-linux-strip boa 3. 配置 Boa 可以在源碼目錄找到這個設定檔，放到 /etc/boa 裡面，有修改的部份如下： [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.boa.org/" target="_blank">Boa</a> 是一套小型的網頁伺服器，很適合應用在 Embedded System 上，並且內建就可以直接支援以 C 寫的 CGI 網頁，這篇是移植 Boa 到 ARM9 S3C2410 平台的過程，Linux 版本為 2.6.17.4，使用 arm-linux toolchain 3.4.1 編譯。</p>
<p><strong>1. 產生 Makefile</strong><br />
下載 Source code 並解壓縮進到 src 目錄。<br />
# ./configure --host=arm-linux</p>
<p><strong>2. 修改 Makefile 使用跨平台編譯</strong><br />
CC = <span style="color:blue">arm-linux-</span>gcc<br />
CPP = <span style="color:blue">arm-linux-</span>gcc -E<br />
# make (如果編譯或執行時有錯誤請看Q&#038;A)<br />
# arm-linux-strip boa</p>
<p><strong>3. 配置 Boa</strong><br />
可以在源碼目錄找到這個設定檔，放到 /etc/boa 裡面，有修改的部份如下：<br />
User 0<br />
Group 0<br />
#DirectoryMaker /usr/lib/boa/boa_indexer<br />
CGIPath /bin:/usr/bin:/var/www/cgi-bin<br />
ScriptAlias /cgi-bin/ /var/www/cgi-bin/</p>
<p>然後需要放一個 <a href='http://blog.linym.net/wp-content/uploads/2007/09/mime.zip' title='mime.zip'>mime.types</a> 檔案在 /etc，我是直接複製 ubuntu 裡的檔案。</p>
<p><strong>4. 加入 boa 執行檔</strong><br />
將編譯好的 boa 執行檔加入檔案系統 /bin，要啟動 server 只要輸入 boa 即可，可到 /var/log/boa 查看 log。</p>
<p><strong>問題 Q&#038;A：</strong><br />
<span id="more-180"></span><br />
<strong>Q：使用 toolchain 3.4.1 編譯出現錯誤</strong><br />
arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o util.o util.c<br />
util.c:100:1: pasting &quot;t&quot; and &quot;->&quot; does not give a valid preprocessing token<br />
make: *** [util.o] Error 1<br />
A：修改 src/compat.h<br />
找到<br />
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff<br />
修改成<br />
#define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff</p>
<p><strong>Q：執行 boa 出現 &quot;gethostbyname::No such file or directory&quot;</strong><br />
A：需將 boa.conf 裡的 ServerName 開頭註解拿掉</p>
<p><strong>Q：無法啟動 Boa，error log 顯示 &quot;boa.c:266.icky Linux kernel bug!:No such file&quot;</strong><br />
A：修改 src/boa.c，將底下判斷式註解掉：<br />
/*if (setuid(0) != -1) {<br />
    DIE(&quot;icky Linux kernel bug!&quot;);<br />
}*/<br />
重新編譯</p>
<p><strong>Q：無法啟動 Boa，error log 顯示 &quot;boa.c:211 - getpwuid....略&quot;</strong><br />
A：修改 src/boa.c，將底下兩個判斷式註解掉：<br />
/*if (passwdbuf == NULL) {<br />
    DIE(&quot;getpwuid&quot;);<br />
}<br />
if (initgroups(passwdbuf->pw_name, passwdbuf->pw_gid) == -1) {<br />
    DIE(&quot;initgroups&quot;);<br />
}*/<br />
重新編譯</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/180/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>S3C2410 RTC Driver 問題</title>
		<link>http://blog.linym.net/archives/179</link>
		<comments>http://blog.linym.net/archives/179#comments</comments>
		<pubDate>Mon, 17 Sep 2007 16:54:04 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/179</guid>
		<description><![CDATA[在 Linux 系統中的時鐘，可分為硬體時鐘及系統時鐘。硬體時鐘可以依賴輔助電源(電池)持續累計時間；而系統時鐘則每次重新啟動就會重置，所以一般 Linux 在開機時會做個和硬體時鐘同步的動作(hwclock -s)，但是在 Embedded Linux 中是要手動操作的。 首先必須正確驅動 S3C2410 的 RTC(Real-Time Clock) 模組才能使用 hwclock 指令，Linux 2.6.10 版本之後應該都有內建驅動，不過在 2.6.14.7 版本中有些問題，會跑出 Segmentation fault 訊息，需要作以下修改。 1. 重新編譯 Kernel 選項 # make menuconfig 在 Device Drivers ---> Character devices ---> < > Enhanced Real Time Clock Support (不要選擇) [*] S3C2410 RTC Driver 2. 修改 arch/arm/mach-s3c2410/mach-smdk2410.c 在 struct [...]]]></description>
			<content:encoded><![CDATA[<p>在 Linux 系統中的時鐘，可分為硬體時鐘及系統時鐘。硬體時鐘可以依賴輔助電源(電池)持續累計時間；而系統時鐘則每次重新啟動就會重置，所以一般 Linux 在開機時會做個和硬體時鐘同步的動作(hwclock -s)，但是在 Embedded Linux 中是要手動操作的。</p>
<p>首先必須正確驅動 S3C2410 的 RTC(Real-Time Clock) 模組才能使用 hwclock 指令，Linux 2.6.10 版本之後應該都有內建驅動，不過在 2.6.14.7 版本中有些問題，會跑出 Segmentation fault 訊息，需要作以下修改。</p>
<p><strong>1. 重新編譯 Kernel 選項 </strong><br />
    # make menuconfig<br />
    在 Device Drivers ---> Character devices ---><br />
    < > Enhanced Real Time Clock Support (不要選擇)<br />
    [*] S3C2410 RTC Driver</p>
<p><strong>2. 修改 arch/arm/mach-s3c2410/mach-smdk2410.c</strong><br />
在 struct platform_device *smdk2410_devices[] 當中加入 <strong>&#038;s3c_device_rtc,</strong>，這個結構已經在 arch/arm/mach-s3c2410/devs.c 定義，應該是忘記加了，修改好後再編譯即完成。</p>
<p><strong>3. 確認驅動載入</strong><br />
Driver 有正確載入開機應該會有<br />
S3C2410 RTC, (c) 2004 Simtec Electronics<br />
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling<br />
並且有 /dev/misc/rtc 裝置</p>
<p><strong>4. 使用 hwclock</strong><br />
先利用 date 指令調整好系統時間，再用 hwclock -w 寫入硬體時鐘，往後開機只要自動執行用 hwclock -s 即可抓到正確的時間囉！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/179/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 自動配置主設備號</title>
		<link>http://blog.linym.net/archives/176</link>
		<comments>http://blog.linym.net/archives/176#comments</comments>
		<pubDate>Sat, 08 Sep 2007 16:58:58 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[驅動程式]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/176</guid>
		<description><![CDATA[在撰寫 Linux 設備驅動程式的時候，如果指定主設備號(MAJOR)為 0，就可以利用 alloc_chrdev_region() 函式讓系統自動分配一個可用 MAJOR 給裝置，程式片段： #define DEV_NAME "LED" //設備名稱 int DEV_MAJOR = 0; //主設備號 int DEV_MINOR = 0; //次設備號 int count = 1; dev_t led_dev; /* Dynamic assign major */ result = alloc_chrdev_region(&#038;led_dev, DEV_MAJOR, count, DEV_NAME); DEV_MAJOR = MAJOR(led_dev); 這樣驅動寫好後載入核心執行，就會分配到一個 MAJOR，可利用 cat /proc/devices 查看，但是如果要存取這個設備，還需要手動用 mknod 在 /dev 建立設備檔，但問題是怎麼知道分配到的設備號碼是什麼？這裡利用一個 shell script 搭配 awk [...]]]></description>
			<content:encoded><![CDATA[<p>在撰寫 Linux 設備驅動程式的時候，如果指定主設備號(MAJOR)為 0，就可以利用 alloc_chrdev_region() 函式讓系統自動分配一個可用 MAJOR 給裝置，程式片段：</p>
<pre>
#define DEV_NAME "LED" //設備名稱
int DEV_MAJOR = 0; //主設備號
int DEV_MINOR = 0; //次設備號
int count = 1;
dev_t led_dev;
/*  Dynamic assign major */
result = alloc_chrdev_region(&#038;led_dev, DEV_MAJOR, count, DEV_NAME);
DEV_MAJOR = MAJOR(led_dev);
</pre>
<p>這樣驅動寫好後載入核心執行，就會分配到一個 MAJOR，可利用 cat /proc/devices 查看，但是如果要存取這個設備，還需要手動用 mknod 在 /dev 建立設備檔，但問題是怎麼知道分配到的設備號碼是什麼？這裡利用一個 shell script 搭配 awk 來達成。</p>
<pre title="code" class="c">

#!/bin/sh
module = &quot;LED&quot; // /proc/device 顯示的名稱
device = &quot;LED&quot; // /dev 要建立的設備檔名稱

major=`cat /proc/devices | awk &quot;\\$2==\&quot;$module\&quot; {print \\$1}&quot;`
mknod /dev/$device c $major 0 //建立字元設備
</pre>
<p>然後只要將這個 script 檔案設成啟動時執行就可以囉！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/176/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 下透過 GPRS 上網</title>
		<link>http://blog.linym.net/archives/171</link>
		<comments>http://blog.linym.net/archives/171#comments</comments>
		<pubDate>Fri, 24 Aug 2007 16:14:10 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[GPRS]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[PPP]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/171</guid>
		<description><![CDATA[基本需求： 可連上 GPRS 的硬體設備 編譯 Kernel 使其支援 PPP 擁有 pppd、chat 兩個程式 PPP 連線的 script 檔案 1. 可連上 GPRS 的硬體設備 可以是專用的 GPRS Modem 或是手機，不過當然要先配置好相關設定及驅動，我是使用 Wavecom Q2403A 這個 GSM/GPRS 模組透過 com port 來實驗。 2. 編譯 Kernel 使其支援 PPP # make menuconfig 選擇 Device Drivers ---> Network device support ---> PPP (point-to-point protocol) support，底下的子項目如果不確定就全選即可。 核心更新後請檢查 /dev/ppp 是否存在，若無可用 mknod [...]]]></description>
			<content:encoded><![CDATA[<p><strong>基本需求：</strong></p>
<ul>
<li>可連上 GPRS 的硬體設備</li>
<li>編譯 Kernel 使其支援 PPP</li>
<li>擁有 pppd、chat 兩個程式</li>
<li>PPP 連線的 script 檔案</li>
</ul>
<p><strong>1. 可連上 GPRS 的硬體設備</strong><br />
可以是專用的 GPRS Modem 或是手機，不過當然要先配置好相關設定及驅動，我是使用 Wavecom Q2403A 這個 GSM/GPRS 模組透過 com port 來實驗。</p>
<p><strong>2. 編譯 Kernel 使其支援 PPP</strong><br />
# make menuconfig<br />
選擇 Device Drivers ---> Network device support ---> PPP (point-to-point protocol) support，底下的子項目如果不確定就全選即可。<br />
核心更新後請檢查 /dev/ppp 是否存在，若無可用 mknod /dev/ppp c 108 0 建立。</p>
<p><strong>3. 擁有 pppd、chat 兩個程式</strong><br />
如果是一般 PC 版本應該都已經有內建了；<del datetime="2007-09-16T01:38:33+00:00">Embedded 平台則可以考慮使用 busybox，裡面也有包含這兩個程式；</del>再不然就自行下載 <a href="http://ppp.samba.org/ppp/download.html" target="_blank">source code</a> 來編譯。</p>
<p><strong>4. PPP 連線的 script 檔案</strong><br />
建立 script 來做 PPP 連線，通常可以在 /usr/share/doc/ppp/examples/scripts 底下找到 ppp-on、ppp-off、ppp-on-dialer 三個範例檔案，不過用範例檔的設定不一定能成功，請參考<a href="http://blog.linym.net/wp-content/uploads/2007/08/gprs.zip">我的檔案</a>，已測試中華電信可以成功。</p>
<p>相關的設定及原理可以參考：</p>
<ul>
<li><a href="http://tldp.org/HOWTO/PPP-HOWTO/">Linux PPP HOWTO</a> (另有<a href="http://linux.cis.nctu.edu.tw/chinese/how-to/PPP-HOWTO.html">中譯版</a>)</li>
<li><a href="http://wiki.openmoko.org/wiki/Manually_using_GPRS">Manually using GPRS</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/171/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>USB 無線網卡驅動移植(ARM)</title>
		<link>http://blog.linym.net/archives/170</link>
		<comments>http://blog.linym.net/archives/170#comments</comments>
		<pubDate>Fri, 17 Aug 2007 17:59:01 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[porting]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/170</guid>
		<description><![CDATA[平台資訊： 核心板：Samsung S3C2410 ARM920T 無線網卡：PCI GW-US54GXS Linux Kernel：2.6.14.7 Cross Compile：arm-linux-gcc 3.4.1 PCI 所推出的無線網卡大多採用 ZB1211(B) 的晶片，算是滿普遍的一種，所以相容性還不錯，成功移植機率比較大。先到官方下載好網卡的 Linux Driver。 1. 解壓縮檔案 tar zxvf GW-US54GXS_Linux_v2.15.0.0_CE.tar.gz 2. 修改 Makefile # Cross Compile CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc CPP=/usr/local/arm/3.4.1/bin/arm-linux-g++ LD=/usr/local/arm/3.4.1/bin/arm-linux-ld ---------------------------------------------------------------------------- # 修改 Kernel Source 所在路徑 KERN_26=y KERNEL_SOURCE=/opt/linux-2.6.14.7 ---------------------------------------------------------------------------- # 修改 MOD_PATH MODPATH=/opt/linux-2.6.14.7/Modules_install/lib/modules/2.6.14.7 ---------------------------------------------------------------------------- # 修改 KDIR KDIR :=/opt/linux-2.6.14.7/Modules_install/lib/modules/2.6.14.7/build ---------------------------------------------------------------------------- 存檔離開 3. 開始編譯 make [...]]]></description>
			<content:encoded><![CDATA[<p><strong>平台資訊：</strong></p>
<blockquote><p>核心板：Samsung S3C2410 ARM920T<br />
無線網卡：PCI GW-US54GXS<br />
Linux Kernel：2.6.14.7<br />
Cross Compile：arm-linux-gcc 3.4.1
</p></blockquote>
<p>PCI 所推出的無線網卡大多採用 ZB1211(B) 的晶片，算是滿普遍的一種，所以相容性還不錯，成功移植機率比較大。先到<a href="http://www.planex.com.tw/" target="_blank">官方</a>下載好網卡的 Linux Driver。</p>
<p><strong>1. 解壓縮檔案</strong><br />
    tar zxvf GW-US54GXS_Linux_v2.15.0.0_CE.tar.gz</p>
<p><strong>2. 修改 Makefile</strong><br />
# Cross Compile<br />
CC=<span style="color:green">/usr/local/arm/3.4.1/bin/arm-linux-</span>gcc<br />
CPP=<span style="color:green">/usr/local/arm/3.4.1/bin/arm-linux-</span>g++<br />
LD=<span style="color:green">/usr/local/arm/3.4.1/bin/arm-linux-</span>ld<br />
----------------------------------------------------------------------------<br />
# 修改 Kernel Source 所在路徑<br />
KERN_26=y<br />
KERNEL_SOURCE=<span style="color:green">/opt/linux-2.6.14.7</span><br />
----------------------------------------------------------------------------<br />
# 修改 MOD_PATH<br />
MODPATH=<span style="color:green">/opt/linux-2.6.14.7/Modules_install/lib/modules/2.6.14.7</span><br />
----------------------------------------------------------------------------<br />
# 修改 KDIR<br />
KDIR :=<span style="color:green">/opt/linux-2.6.14.7/Modules_install/lib/modules/2.6.14.7/build</span><br />
----------------------------------------------------------------------------<br />
存檔離開</p>
<p><strong>3. 開始編譯</strong><br />
make ZD1211REV_B=1</p>
<p><strong>4. 完成</strong><br />
沒錯誤就會得到 zd1211b.ko，將它加入檔案系統並用 insmod 載入即可。</p>
<p>延伸閱讀</p>
<ul>
<li><a href="http://www.jollen.org/blog/2006/10/03/jollen.org_Lecture_8_%20Mesh%20Router%20Project.pdf">Embedded Linux + ARM</a></li>
<li><a href="http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html">Wireless Tools for Linux</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/170/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>LPIC 中文試題考試</title>
		<link>http://blog.linym.net/archives/152</link>
		<comments>http://blog.linym.net/archives/152#comments</comments>
		<pubDate>Wed, 27 Jun 2007 11:44:47 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[資訊新聞]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[LPIC]]></category>
		<category><![CDATA[證照]]></category>

		<guid isPermaLink="false">http://blog.linym.net/archives/152</guid>
		<description><![CDATA[今天在綠色工廠看到了這個消息，有點心動阿！ LPI Level 1 認證出現首次的正體中文試題，比較不會有看不懂題目的問題，所以正在考慮要不要報名，不過一科 4080元 對學生真是一大負擔，如果 101、102 一起報就要 8160 元了...orz 報名到 7/15 截止，八月考試。 比較不一樣的是中文版考試是採用筆試，和原本線上考不一樣。 活動網址：http://brain-c.com/lpic/]]></description>
			<content:encoded><![CDATA[<p>今天在<a href="http://portable.easylife.idv.tw/945" target="_blank">綠色工廠</a>看到了這個消息，有點心動阿！</p>
<p>LPI Level 1 認證出現首次的正體中文試題，比較不會有看不懂題目的問題，所以正在考慮要不要報名，不過一科 4080元 對學生真是一大負擔，如果 101、102 一起報就要 8160 元了...orz</p>
<p><strong>報名到 7/15 截止</strong>，八月考試。</p>
<p>比較不一樣的是中文版考試是採用筆試，和原本線上考不一樣。</p>
<p>活動網址：<a href="http://brain-c.com/lpic/" target="_blank">http://brain-c.com/lpic/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/152/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>StepMotor Driver &amp; Test program</title>
		<link>http://blog.linym.net/archives/137</link>
		<comments>http://blog.linym.net/archives/137#comments</comments>
		<pubDate>Wed, 16 May 2007 17:34:33 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/137</guid>
		<description><![CDATA[FS2410XP 是滿多學校的嵌入式教學實驗平台，板子上有兩個馬達模組，廠商的 demo 程式有一些範例，我將步進馬達完整移植到 Embedded Linux 上，方便作更多的應用。附件包含驅動程式、測試程式及投影片。 在 DOS 的 C 程式有個有個函數叫 kbhit()，可動態偵測鍵盤有無輸入，不用停住等待，不過在 Linux 上沒有 kbhit() 及 getch() 可以用，好在國外有人實作出相同功能的函數，請參考 kbhit.c StepMotor 用法： 進入 linux cd /tmp 輸入 rz 上傳 stepper.o、step_test insmod stepper.o mknod /dev/stepper c 225 0 chmod 755 step_test ./step_test]]></description>
			<content:encoded><![CDATA[<p>FS2410XP 是滿多學校的嵌入式教學實驗平台，板子上有兩個馬達模組，廠商的 demo 程式有一些範例，我將步進馬達完整移植到 Embedded Linux 上，方便作更多的應用。附件包含驅動程式、測試程式及投影片。</p>
<p>在 DOS 的 C 程式有個有個函數叫 kbhit()，可動態偵測鍵盤有無輸入，不用停住等待，不過在 Linux 上沒有 kbhit() 及 getch() 可以用，好在國外有人實作出相同功能的函數，請參考 <a href="http://my.execpc.com/~geezer/software/kbhit.c">kbhit.c</a></p>
<p><a href='http://blog.linym.net/wp-content/uploads/2007/05/stepmotor.exe' title='StepMotor'>StepMotor</a></p>
<p><strong>用法：</strong></p>
<ol>
<li>進入 linux</li>
<li>cd /tmp</li>
<li>輸入 rz 上傳 stepper.o、step_test</li>
<li>insmod stepper.o</li>
<li>mknod /dev/stepper c 225 0</li>
<li>chmod 755 step_test</li>
<li>./step_test</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/137/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache mod_rewrite (Ubuntu)</title>
		<link>http://blog.linym.net/archives/119</link>
		<comments>http://blog.linym.net/archives/119#comments</comments>
		<pubDate>Sat, 03 Feb 2007 10:55:13 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/119</guid>
		<description><![CDATA[要使用 mod_rewrite 模組在 Ubuntu 中是非常容易的，如果安裝 Ubuntu 時有順便裝 LAMP，那其實 mod_rewrite 就已經編譯好了，只需要將它載入即可。 所有可載入的模組和設定可以在 /etc/apache2/mods-available 找到，之後只要作個 Link 到 mods-enabled 目錄即可使用。 但是不需要這麼麻煩，因為有 a2enmod、a2dismod、a2ensite、a2dissite，這些指令可以更方便的載入、關閉模組，例如想要開啟 rewrite 只要鍵入： sudo a2enmod rewrite sudo /etc/init.d/apache2 restart 就可以了]]></description>
			<content:encoded><![CDATA[<p>要使用 mod_rewrite 模組在 Ubuntu 中是非常容易的，如果安裝 Ubuntu 時有順便裝 LAMP，那其實 mod_rewrite 就已經編譯好了，只需要將它載入即可。</p>
<p>所有可載入的模組和設定可以在 <strong>/etc/apache2/mods-available </strong>找到，之後只要作個 Link 到 mods-enabled 目錄即可使用。<br />
但是不需要這麼麻煩，因為有 a2enmod、a2dismod、a2ensite、a2dissite，這些指令可以更方便的載入、關閉模組，例如想要開啟 rewrite 只要鍵入：</p>
<blockquote><p>sudo a2enmod rewrite<br />
sudo /etc/init.d/apache2 restart</p></blockquote>
<p>就可以了</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/119/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iptables 防火牆規則</title>
		<link>http://blog.linym.net/archives/97</link>
		<comments>http://blog.linym.net/archives/97#comments</comments>
		<pubDate>Fri, 13 Jan 2006 10:11:00 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[防火牆]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/97</guid>
		<description><![CDATA[還原規則：iptables-restore &#60; 檔案名稱 *filter :FORWARD ACCEPT [0:0] :INPUT ACCEPT [0:0] :OUTPUT ACCEPT [355059:275915118] # 接受確認連線 -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT # 接受 loopback 連線 -A INPUT -i lo -j ACCEPT # 接受 icmp 封包 -A INPUT -p icmp -j ACCEPT # 本機特定服務 -A INPUT -p tcp -m tcp --dport 20:21 -j ACCEPT [...]]]></description>
			<content:encoded><![CDATA[<p>還原規則：<em>iptables-restore &lt; 檔案名稱</em></p>
<pre>
*filter
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [355059:275915118]
# 接受確認連線
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# 接受 loopback 連線
-A INPUT -i lo -j ACCEPT
# 接受 icmp 封包
-A INPUT -p icmp -j ACCEPT
# 本機特定服務
-A INPUT -p tcp -m tcp --dport 20:21 -j ACCEPT # FTP
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT # SSH
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT # DNS
-A INPUT -p udp -m udp --dport 53 -j ACCEPT # DNS
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT # HTTP
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT # HTTPS
-A INPUT -p tcp -m tcp --dport 65400:65500 -j ACCEPT # FTP PASV
# 其餘全部封殺
-A INPUT -j DROP
COMMIT
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/97/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora Core 的 Bind 路徑</title>
		<link>http://blog.linym.net/archives/5</link>
		<comments>http://blog.linym.net/archives/5#comments</comments>
		<pubDate>Mon, 15 Nov 2004 02:08:37 +0000</pubDate>
		<dc:creator>lym520</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[系統筆記]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[fedora]]></category>

		<guid isPermaLink="false">http://lym.fyman.idv.tw/blog/archives/5</guid>
		<description><![CDATA[在 Fedora Core 的 Bind 設定檔路徑和以往不太一樣，全部都移到了chroot 目錄底下，以提高安全性，底下是變更後的檔案位置： named.conf 原始： /etc/named.conf 更改為： /var/named/chroot/etc/named.conf 根網域記錄檔 原始： /var/named/named.ca 更改為： /var/named/chroot/var/named/named.ca 正反解記錄檔 原始： /var/named/ 更改為： /var/named/chroot/var/named/ 接著啟動 named 後您的 DNS Server 就可以正常運作囉!!]]></description>
			<content:encoded><![CDATA[<p>在 Fedora Core 的 Bind 設定檔路徑和以往不太一樣，全部都移到了chroot 目錄底下，以提高安全性，底下是變更後的檔案位置：</p>
<p><strong>named.conf</strong><br />
原始： /etc/named.conf<br />
更改為： /var/named/chroot/etc/named.conf</p>
<p><strong>根網域記錄檔</strong><br />
原始： /var/named/named.ca<br />
更改為： /var/named/chroot/var/named/named.ca</p>
<p><strong>正反解記錄檔</strong><br />
原始： /var/named/<br />
更改為： /var/named/chroot/var/named/</p>
<p>接著啟動 named 後您的 DNS Server 就可以正常運作囉!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.linym.net/archives/5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

