<?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>诗意代码 - PoemCode &#187; Linux</title>
	<atom:link href="http://www.poemcode.net/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.poemcode.net</link>
	<description>These codes, As beautiful as poetry!</description>
	<lastBuildDate>Wed, 08 Sep 2010 04:57:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Linux x86 编译 Android 遭遇 gnu/stubs-64.h</title>
		<link>http://www.poemcode.net/2010/07/android-stubs-64/</link>
		<comments>http://www.poemcode.net/2010/07/android-stubs-64/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 07:27:11 +0000</pubDate>
		<dc:creator>Xu Haojie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.poemcode.net/?p=1365</guid>
		<description><![CDATA[<div class="wp-caption alignright" style="width: 76px"><img class="size-full wp-image-521" title="Android" src="http://www.poemcode.net/wp-content/uploads/2009/09/android.gif" alt="Android" width="76" height="90" /></div> 
这两天心血来潮，执行完 repo sync 后，顺手来了一下 make，不料却发现了以下的错误。

兵来将挡，水来土掩，用关键字 android "error: gnu/stubs-64.h: no such file or directory" 来搜一下吧，发现搜索结果寥寥无几，看样子问题比较新，其中有一个 CSDN 的链接，就顺手点了过去。帖子反映的问题和我一模一样，不过它的分析给了我一些提醒。

<pre lang="text">
host C: libclearsilver-jni <= external/clearsilver/java-jni/j_neo_util.c
In file included from /usr/include/features.h:378,
                      from /usr/include/string.h:26,
		      from external/clearsilver/java-jni/j_neo_util.c:1:
/usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: No such file or directory
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/j_neo_util.o] Error 1
</pre>]]></description>
			<content:encoded><![CDATA[<p>这两天心血来潮，执行完 repo sync 后，顺手来了一下 make，不料却发现了以下的错误：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">host C: libclearsilver-jni &lt;= external/clearsilver/java-jni/j_neo_util.c
In file included from /usr/include/features.h:378,
                      from /usr/include/string.h:26,
		      from external/clearsilver/java-jni/j_neo_util.c:1:
/usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: No such file or directory
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libclearsilver-jni_intermediates/j_neo_util.o] Error 1</pre></div></div>

<p>兵来将挡，水来土掩，用关键字 android &#8220;error: gnu/stubs-64.h: no such file or directory&#8221; 来搜一下吧，发现搜索结果寥寥无几，看样子问题比较新，其中有一个 CSDN 的<a href="http://topic.csdn.net/u/20100704/15/06d940c3-2ce9-4a15-a182-98a39c74f77a.html?20065" target="blank">链接</a>，就顺手点了过去。帖子反映的问题和我一模一样，不过它的分析给了我一些提醒。</p>
<p>从错误信息入手，追踪到/usr/include/gnu/stubs.h，看到如下代码：</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#if __WORDSIZE == 32</span>
<span style="color: #339933;"># include &lt;gnu/stubs-32.h&gt;</span>
<span style="color: #339933;">#elif __WORDSIZE == 64</span>
<span style="color: #339933;"># include &lt;gnu/stubs-64.h&gt;</span>
<span style="color: #339933;">#else</span>
<span style="color: #339933;"># error &quot;unexpected value for __WORDSIZE macro&quot;</span>
<span style="color: #339933;">#endif</span></pre></div></div>

<p>顺着 WORDSIZE，进入/usr/include/bits/wordsize，发现：</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#if defined __x86_64__</span>
<span style="color: #339933;"># define __WORDSIZE	64</span>
<span style="color: #339933;"># define __WORDSIZE_COMPAT32	1</span>
<span style="color: #339933;">#else</span>
<span style="color: #339933;"># define __WORDSIZE	32</span>
<span style="color: #339933;">#endif</span></pre></div></div>

<p>结合报错的信息，可以知道这里一定是有定义__x86_64__，执行一下 uname -a 可以确认 OS 明明是x86，为什么会__x86_64__呢？追根溯源， Android 源码或许能露出蛛丝马迹。</p>
<p>果不其然，从 android.git.kernel.org 的 platform/external/clearsilver.git 上，看到5天前，有个 Ying Wang 的家伙提交一个修改：Fix 64-bit clearsilver shared library issue，参看<a href="http://android.git.kernel.org/?p=platform/external/clearsilver.git;a=commit;h=d36910a8110d8377b22301274d2b5131a732a72b" target="blank">这里</a>，修改内容中 java-jni/Android.mk，和出现本次问题的路径 java-jni/j_neo_util.c，同属一个父目录，看样子有点关系，查看 Android.mk 的修改内容，发现做了如下修改：</p>

<div class="wp_syntax"><div class="code"><pre class="diff" style="font-family:monospace;">+# This forces a <span style="">64</span>-bit build for Java6
<span style="color: #00b000;">+ifneq <span style="">&#40;</span>$<span style="">&#40;</span>filter <span style="">1.6</span>%,$<span style="">&#40;</span>java_version<span style="">&#41;</span><span style="">&#41;</span>,<span style="">&#41;</span></span>
<span style="color: #00b000;">+    LOCAL_CFLAGS += -m64</span>
<span style="color: #00b000;">+    LOCAL_LDFLAGS += -m64</span>
<span style="color: #00b000;">+endif</span></pre></div></div>

<p>当发现你使用Java6时，它将强制使用64-bit，我想这就能解释__x86_64__出现的原因。那么既然它要64-bit，我就满足它。首先要解决 gnu/stubs-64.h: No such file or directory，解决这个问题需要执行以下命令：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[xuhj@eniac mydroid]$ apt-get install libc6-dev-amd64</pre></div></div>

<p>完成以后再执行 make，发现有错误：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/usr/bin/ld: cannot find -lstdc++</pre></div></div>

<p>那就继续满足它：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[xuhj@eniac mydroid]$ apt-get install g++-multilib lib64stdc++6</pre></div></div>

<p>还是不行，又发生下面的错误：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/usr/bin/ld: cannot find -lz</pre></div></div>

<p>再来执行命令：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[xuhj@eniac mydroid]$ apt-get install lib64z1-dev</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.poemcode.net/2010/07/android-stubs-64/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Linux 通过 gphoto2 操作 Canon 450D</title>
		<link>http://www.poemcode.net/2010/06/linux-gphoto2-canon/</link>
		<comments>http://www.poemcode.net/2010/06/linux-gphoto2-canon/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 07:13:12 +0000</pubDate>
		<dc:creator>Xu Haojie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.poemcode.net/?p=1320</guid>
		<description><![CDATA[<div class="wp-caption alignright" style="width: 76px"><img class="size-full wp-image-631" title="Linux" src="http://www.poemcode.net/wp-content/uploads/2009/09/linux.gif" alt="Linux" width="76" height="90" /></div>

摆弄450D有一段时间了，每次使用 Windows 自带的数码相机向导，把照片从相机导入到笔记本，接下来用 PhotoShop 进行 PS。直到今天，心血来潮，倒腾一下，把照片直接导入到 Debian 上，以下记录了这个过程，其中所遇到的问题和解决办法相信对自己今后或别人是个帮助。

首先，安装两个软件，基于命令行（command-line）的 gphoto2 和图形界面的 gtkaw。如果你是命令行的狂热粉丝，那么后者可以不安装，不会影响到任何操作。]]></description>
			<content:encoded><![CDATA[<div id="attachment_1334" class="wp-caption alignright" style="width: 192px"><img class="size-medium wp-image-1334" title="gphoto-logo" src="http://www.poemcode.net/wp-content/uploads/2010/06/gphoto-logo-182x225.png" alt="gphoto-logo" width="182" height="225" /><p class="wp-caption-text">gPhoto2</p></div>
<p>摆弄450D有一段时间了，每次使用 Windows 自带的数码相机向导，把照片从相机导入到笔记本，接下来用 PhotoShop 进行 PS。直到今天，心血来潮，倒腾一下，把照片直接导入到 Debian 上，以下记录了这个过程，其中所遇到的问题和解决办法相信对自己今后或别人是个帮助。</p>
<p>首先，安装两个软件，基于命令行（command-line）的 gphoto2 和图形界面的 gtkaw。如果你是命令行的狂热粉丝，那么后者可以不安装，不会影响到任何操作。</p>
<p>在安装之前，先来了解下你将要使用使用的工具：</p>
<blockquote><p>gPhoto2 is a free, redistributable, ready to use set of digital camera software applications for Unix-like systems, written by a whole team of dedicated volunteers around the world. It supports more than 1200 cameras</p>
<p>gPhoto2 runs on a large range of UNIX-like operating system, including Linux, FreeBSD, NetBSD, MacOS X, etc. gPhoto is provided by major Linux distributions like Debian GNU/Linux, Ubuntu, Gentoo, Fedora, openSUSE, Mandriva, etc.</p>
<p style="text-align: right;">&#8211; www.gphoto.org</p>
</blockquote>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">eniac:~# apt-get install gphoto2 gtkaw</pre></div></div>

<p>然后，连接好 Cannon 450D和笔记本，打开450D，执行命令，查看 gphoto2 是否识别到了450D：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">xuhj@eniac:~/img/450D$ gphoto2 --auto-detect
&nbsp;
Model                          Port
----------------------------------------------------------
Canon EOS 450D (PTP mode)      usb:
Canon EOS 450D (PTP mode)      usb:001,013</pre></div></div>

<p>看来比较顺利，接下来查看450D都有哪些文件：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">xuhj@eniac:~/img/450D$ gphoto2 -L
&nbsp;
*** Error ***
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Operation not permitted). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.
*** Error (-53: 'Could not claim the USB device') ***       
&nbsp;
For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list , please run
gphoto2 as follows:
&nbsp;
    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --list-files
&nbsp;
Please make sure there is sufficient quoting around the arguments.</pre></div></div>

<p>看样子遇到了大麻烦，还好从 gphoto2 的官网上了解到问题的<a title="Why do I get the error message " href="http://www.gphoto.org/doc/manual/FAQ.html#FAQ-could-not-claim-USB" target="blank">原因</a>：</p>
<blockquote><p>You have to make sure that no such kernel module is loaded and that you have set up the permissions on your USB device correctly, such that you have (non-root) write access to the camera device.</p></blockquote>
<p>根据官方给出的<a title="Setting up permissions for USB ports" target="blank">建议</a>，执行下面的命令：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">eniac:~#/usr/lib/libgphoto2/print-camera-list \
    udev-rules version 0.98 group plugdev mode 0660 \
    &amp;gt; /etc/udev/rules.d/90-libgphoto2.rules</pre></div></div>

<p>完了以后，再来查看文件：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">xuhj@eniac:~/img/450D$ gphoto2 -L
There is no file in folder '/'.
There is no file in folder '/store_00020001'.
There is no file in folder '/store_00020001/DCIM'.
There are 5 files in folder '/store_00020001/DCIM/100CANON'.
#1     IMG_3471.JPG               rd  1685 KB 3088x2056 image/jpeg
#2     IMG_3472.JPG               rd  1598 KB 3088x2056 image/jpeg
#3     IMG_3473.JPG               rd  1782 KB 3088x2056 image/jpeg
#4     IMG_3474.JPG               rd  1624 KB 3088x2056 image/jpeg
#5     IMG_3475.JPG               rd  1870 KB 3088x2056 image/jpeg
There is 1 file in folder '/store_00020001/MISC'.
#6     AUTXFER.MRK                r-     1 KB text/plain</pre></div></div>

<p>哈，看来办法奏效了，接下来就是拷贝需要的文件到当前目录了：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">xuhj@eniac:~/img/450D$ gphoto2 -p 1-5
Downloading 'IMG_3471.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_3471.JPG
Downloading 'IMG_3472.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_3472.JPG
Downloading 'IMG_3473.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_3473.JPG
Downloading 'IMG_3474.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_3474.JPG
Downloading 'IMG_3475.JPG' from folder '/store_00020001/DCIM/100CANON'...
Saving file as IMG_3475.JPG</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.poemcode.net/2010/06/linux-gphoto2-canon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>让Linux用上CDMA 3G</title>
		<link>http://www.poemcode.net/2009/11/linux_cdma_3g/</link>
		<comments>http://www.poemcode.net/2009/11/linux_cdma_3g/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 04:20:33 +0000</pubDate>
		<dc:creator>Xu Haojie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.poemcode.net/?p=743</guid>
		<description><![CDATA[<div class="wp-caption alignright" style="width: 76px"><img class="size-full wp-image-631" title="Linux" src="http://www.poemcode.net/wp-content/uploads/2009/09/linux.gif" alt="Linux" width="76" height="90" /></div>

这段时间需要接入移动互联网，刚好手上有一个中国电信的上网卡，于是就萌生了在 Linux 下驱动上网卡的念头。这款上网卡的铭牌上标识其型号是 HUAWEI EC1261，官方驱动除了 Windows 外，还支持 MAC OSX，－－华为越来越具备国际厂商的气质了。

由于官方没有提供 Linux 驱动，因此也就只好到社区查找资源，在 Linux 和百度 Hi 上找到了两条重要信息：《 ubuntu支持3G无线网卡吗》和《Ubuntu Fedora RedHat电信天翼CDMA 1x EV-DO(3G)上网》，于是找到了迈向目标的大道。]]></description>
			<content:encoded><![CDATA[<div id="attachment_631" class="wp-caption alignleft" style="width: 86px"><img class="size-full wp-image-631" title="Linux" src="http://www.poemcode.net/wp-content/uploads/2009/09/linux.gif" alt="Linux" width="76" height="90" /><p class="wp-caption-text">Linux</p></div>
<p>这段时间需要接入移动互联网，刚好手上有一个中国电信的上网卡，于是就萌生了在 Linux 下驱动上网卡的念头。这款上网卡的铭牌上标识其型号是 HUAWEI EC1261，官方驱动除了 Windows 外，还支持 MAC OSX，－－华为越来越具备国际厂商的气质了。</p>
<p>由于官方没有提供 Linux 驱动，因此也就只好到社区查找资源，在 Linux 和百度 Hi 上找到了两条重要信息：<a title="ubuntu支持3G无线网卡吗？" href="http://www.linuxsir.org/bbs/thread350880.html" target="_blank">《 ubuntu支持3G无线网卡吗》</a>和<a title="Ubuntu Fedora RedHat电信天翼CDMA 1x EV-DO(3G)上网，华为HUAWEI EC226，屡试不爽，再发一次" href="http://hi.baidu.com/netbusy/blog/item/4a7bfc80c61793df9123d95a.html" target="_blank">《Ubuntu Fedora RedHat电信天翼CDMA 1x EV-DO(3G)上网》</a>，于是找到了迈向目标的大道。</p>
<p>在插入上网卡之前，先来观察一下当前的网络连接状态：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">eniac<span style="color: #339933;">:/</span>home<span style="color: #339933;">/</span>xuhj# ifconfig
lo        Link encap<span style="color: #339933;">:</span>Local Loopback
          inet addr<span style="color: #339933;">:</span>127.0.0.1  Mask<span style="color: #339933;">:</span>255.0.0.0
          UP LOOPBACK RUNNING  MTU<span style="color: #339933;">:</span><span style="color: #cc66cc;">16436</span>  Metric<span style="color: #339933;">:</span><span style="color: #cc66cc;">1</span>
          RX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">18</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> frame<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          TX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">18</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> carrier<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          collisions<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> txqueuelen<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          RX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">1060</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1.0</span> KiB<span style="color: #009900;">&#41;</span>  TX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">1060</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1.0</span> KiB<span style="color: #009900;">&#41;</span>
&nbsp;
wlan0     Link encap<span style="color: #339933;">:</span>Ethernet  HWaddr 00<span style="color: #339933;">:</span>1a<span style="color: #339933;">:</span><span style="color: #cc66cc;">73</span><span style="color: #339933;">:</span>08<span style="color: #339933;">:</span>1b<span style="color: #339933;">:</span>7d
          inet addr<span style="color: #339933;">:</span>192.168.1.143  Bcast<span style="color: #339933;">:</span>192.168.1.255  Mask<span style="color: #339933;">:</span>255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU<span style="color: #339933;">:</span><span style="color: #cc66cc;">1500</span>  Metric<span style="color: #339933;">:</span><span style="color: #cc66cc;">1</span>
          RX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">785</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> frame<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          TX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">812</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> carrier<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          collisions<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> txqueuelen<span style="color: #339933;">:</span><span style="color: #cc66cc;">1000</span>
          RX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">655845</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">640.4</span> KiB<span style="color: #009900;">&#41;</span>  TX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">184551</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">180.2</span> KiB<span style="color: #009900;">&#41;</span></pre></div></div>

<p>插入上网卡，由于是采用USB接口，所以可以通过 lssub 来查看一下：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">eniac<span style="color: #339933;">:/</span>home<span style="color: #339933;">/</span>xuhj# lsusb
Bus 003 Device 002<span style="color: #339933;">:</span> ID 08ff<span style="color: #339933;">:</span><span style="color: #cc66cc;">2580</span> AuthenTec, Inc. <span style="color: #006633;">AES2501</span> Fingerprint Sensor
Bus 003 Device 001<span style="color: #339933;">:</span> ID 1d6b<span style="color: #339933;">:</span>0001 Linux Foundation <span style="color: #cc66cc;">1.1</span> root hub
Bus 002 Device 003<span style="color: #339933;">:</span> ID 12d1<span style="color: #339933;">:</span><span style="color: #cc66cc;">1001</span> Huawei Technologies Co., Ltd. <span style="color: #006633;">E620</span> USB Modem
Bus 002 Device 001<span style="color: #339933;">:</span> ID 1d6b<span style="color: #339933;">:</span>0001 Linux Foundation <span style="color: #cc66cc;">1.1</span> root hub
Bus 001 Device 001<span style="color: #339933;">:</span> ID 1d6b<span style="color: #339933;">:</span>0002 Linux Foundation <span style="color: #cc66cc;">2.0</span> root hub</pre></div></div>

<p>看来由于未知原因，系统并没有正确识别出型号，不过不管怎样，继续往下试试看，开始安装wvdial，并在安装完之后，执行wvdialconf</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">eniac<span style="color: #339933;">:/</span>home<span style="color: #339933;">/</span>xuhj#  apt<span style="color: #339933;">-</span>get install wvdial
eniac<span style="color: #339933;">:/</span>home<span style="color: #339933;">/</span>xuhj# wvdialconf</pre></div></div>

<p>此时会有提示告诉你修改 /etc/wvdial.conf，修改后的结果如下：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>Dialer cdma1x<span style="color: #009900;">&#93;</span>
Init1 <span style="color: #339933;">=</span> ATZ
Init2 <span style="color: #339933;">=</span> ATQ0 V1 E1 S0<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;</span>C1 <span style="color: #339933;">&amp;</span>D2 <span style="color: #339933;">+</span>FCLASS<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span>
Modem Type <span style="color: #339933;">=</span> Analog Modem
Baud <span style="color: #339933;">=</span> <span style="color: #cc66cc;">9600</span>
<span style="color: #000000; font-weight: bold;">New</span> PPPD <span style="color: #339933;">=</span> yes
Modem <span style="color: #339933;">=</span> <span style="color: #339933;">/</span>dev<span style="color: #339933;">/</span>ttyUSB0
ISDN <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span>
Phone <span style="color: #339933;">=</span> #<span style="color: #cc66cc;">777</span>
Password <span style="color: #339933;">=</span> CARD
Username <span style="color: #339933;">=</span> CARD
&nbsp;
<span style="color: #009900;">&#91;</span>Dialer cdma3g<span style="color: #009900;">&#93;</span>
Init1 <span style="color: #339933;">=</span> ATZ
Init2 <span style="color: #339933;">=</span> ATQ0 V1 E1 S0<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;</span>C1 <span style="color: #339933;">&amp;</span>D2 <span style="color: #339933;">+</span>FCLASS<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span>
Modem Type <span style="color: #339933;">=</span> Analog Modem
Baud <span style="color: #339933;">=</span> <span style="color: #cc66cc;">9600</span>
<span style="color: #000000; font-weight: bold;">New</span> PPPD <span style="color: #339933;">=</span> yes
Modem <span style="color: #339933;">=</span> <span style="color: #339933;">/</span>dev<span style="color: #339933;">/</span>ttyUSB0
ISDN <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span>
Phone <span style="color: #339933;">=</span> #<span style="color: #cc66cc;">777</span>
Password <span style="color: #339933;">=</span> ctnet@mycdma.<span style="color: #006633;">cn</span>
Username <span style="color: #339933;">=</span> vnet.<span style="color: #006633;">mobi</span></pre></div></div>

<p>这里配置了 CDMA 1x 和 CDMA 3G 两种连接方式，执行命令接入 3G：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">eniac<span style="color: #339933;">:/</span>home<span style="color: #339933;">/</span>xuhj# wvdial cdma3g</pre></div></div>

<p>此时，再来查看网络连接状态：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">eniac<span style="color: #339933;">:/</span>home<span style="color: #339933;">/</span>xuhj# ifconfig
lo        Link encap<span style="color: #339933;">:</span>Local Loopback
          inet addr<span style="color: #339933;">:</span>127.0.0.1  Mask<span style="color: #339933;">:</span>255.0.0.0
          UP LOOPBACK RUNNING  MTU<span style="color: #339933;">:</span><span style="color: #cc66cc;">16436</span>  Metric<span style="color: #339933;">:</span><span style="color: #cc66cc;">1</span>
          RX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">110</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> frame<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          TX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">110</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> carrier<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          collisions<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> txqueuelen<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          RX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">5660</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5.5</span> KiB<span style="color: #009900;">&#41;</span>  TX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">5660</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5.5</span> KiB<span style="color: #009900;">&#41;</span>
&nbsp;
ppp0      Link encap<span style="color: #339933;">:</span>Point<span style="color: #339933;">-</span>to<span style="color: #339933;">-</span><span style="color: #003399;">Point</span> Protocol
          inet addr<span style="color: #339933;">:</span>113.114.14.188  P<span style="color: #339933;">-</span>t<span style="color: #339933;">-</span>P<span style="color: #339933;">:</span>115.168.82.68  Mask<span style="color: #339933;">:</span>255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU<span style="color: #339933;">:</span><span style="color: #cc66cc;">1500</span>  Metric<span style="color: #339933;">:</span><span style="color: #cc66cc;">1</span>
          RX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">20</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">1</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> frame<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          TX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">5</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> carrier<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          collisions<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> txqueuelen<span style="color: #339933;">:</span><span style="color: #cc66cc;">3</span>
          RX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">2248</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2.1</span> KiB<span style="color: #009900;">&#41;</span>  TX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">97</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">97.0</span> B<span style="color: #009900;">&#41;</span>
&nbsp;
wlan0     Link encap<span style="color: #339933;">:</span>Ethernet  HWaddr 00<span style="color: #339933;">:</span>1a<span style="color: #339933;">:</span><span style="color: #cc66cc;">73</span><span style="color: #339933;">:</span>08<span style="color: #339933;">:</span>1b<span style="color: #339933;">:</span>7d
          inet addr<span style="color: #339933;">:</span>192.168.1.143  Bcast<span style="color: #339933;">:</span>192.168.1.255  Mask<span style="color: #339933;">:</span>255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU<span style="color: #339933;">:</span><span style="color: #cc66cc;">1500</span>  Metric<span style="color: #339933;">:</span><span style="color: #cc66cc;">1</span>
          RX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">2504</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> frame<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          TX packets<span style="color: #339933;">:</span><span style="color: #cc66cc;">2703</span> errors<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> dropped<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> overruns<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> carrier<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span>
          collisions<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> txqueuelen<span style="color: #339933;">:</span><span style="color: #cc66cc;">1000</span>
          RX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">1775401</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1.6</span> MiB<span style="color: #009900;">&#41;</span>  TX bytes<span style="color: #339933;">:</span><span style="color: #cc66cc;">924389</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">902.7</span> KiB<span style="color: #009900;">&#41;</span></pre></div></div>

<p>可以看到 ppp0 已经在列，同理也可以接入1x，到此大功告成。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poemcode.net/2009/11/linux_cdma_3g/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>向Grub2中添加Windows XP</title>
		<link>http://www.poemcode.net/2009/09/grub/</link>
		<comments>http://www.poemcode.net/2009/09/grub/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 14:07:44 +0000</pubDate>
		<dc:creator>Xu Haojie</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.poemcode.net/?p=624</guid>
		<description><![CDATA[<div class="wp-caption alignright" style="width: 76px"><img class="size-full wp-image-631" title="Linux" src="http://www.poemcode.net/wp-content/uploads/2009/09/linux.gif" alt="Linux" width="76" height="90" /></div>

前几天将 Debian 从 Lenny 升级到 Testing，其中 Grub2 是值得称道的新特色之一。升级之后，系统重启可以看到提示执行 upgrade-from-grub-legacy。不过由于担心出问题，一直也就没有执行。

经过几天的测试，也没发现问题，于是今天就执行了上面的命令。重启电脑之后，发现初始画面漂亮了。不过，发现一个意想不到的问题：原本可以进入 Windows XP 的选项，竟然不见了。]]></description>
			<content:encoded><![CDATA[<div id="attachment_631" class="wp-caption alignright" style="width: 86px"><img class="size-full wp-image-631" title="Linux" src="http://www.poemcode.net/wp-content/uploads/2009/09/linux.gif" alt="Linux" width="76" height="90" /><p class="wp-caption-text">Linux</p></div>
<p>前几天将 Debian 从 Lenny 升级到 Testing，其中 Grub2 是值得称道的新特色之一。升级之后，系统重启可以看到提示执行 upgrade-from-grub-legacy。不过由于担心出问题，一直也就没有执行。</p>
<p>经过几天的测试，也没发现问题，于是今天就执行了上面的命令。重启电脑之后，发现初始画面漂亮了。不过，发现一个意想不到的问题：原本可以进入 Windows XP 的选项，竟然不见了。</p>
<p>一番搜索，查阅文档之后，找到了解决的方法。首先从原来的配置文件 /boot/grub/menu.lst 里找出原来引导 Windows XP 的内容：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">title       Microsoft Windows XP Professional
root        (hd0,0)
savedefault
makeactive
chainloader +1</pre></div></div>

<p>然后找到新的配置文件 ／boot/grub/grub.cfg，由于该文件默认是不允许修改的，因此首先修改它的权限：</p>
<blockquote><p>chmod +w grub.cfg</p></blockquote>
<p>然后把下面的内容加入进去，这里需要注意，原来是&lt;0,hd0&gt;，而现在是&lt;0, hd1&gt;</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">menuentry &quot;Windows XP&quot; {
        set root=(hd0,1)
        chainloader +1
}</pre></div></div>

<p>完成之后，重启即可看到效果，Windows XP  的选项已经在列。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poemcode.net/2009/09/grub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android成为Linux主流</title>
		<link>http://www.poemcode.net/2009/03/android%e6%88%90%e4%b8%balinux%e4%b8%bb%e6%b5%81/</link>
		<comments>http://www.poemcode.net/2009/03/android%e6%88%90%e4%b8%balinux%e4%b8%bb%e6%b5%81/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 02:02:46 +0000</pubDate>
		<dc:creator>Xu Haojie</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.poemcode.net/?p=128</guid>
		<description><![CDATA[<div class="wp-caption alignright" style="width: 76px"><img class="size-full wp-image-521" title="Android" src="http://www.poemcode.net/wp-content/uploads/2009/09/android.gif" alt="Android" width="76" height="90" /></div> 
一个操作系统要想和微软Windows争夺市场份额，它需要两个东西：操作系统开发商的支持和廉价的许可费。

近期，由Google支撑的Android系统被“非官方”移植到Asus Eee PC上网本，根据报告，台湾制造商已经成了一个小组来开发运行在基于Linux操作系统的上网本。

Daiwa Securities的分析员Calvin Huang在一次采访中告诉ZDNet，Android在几个方面能够“杀死微软”：有大公司撑腰的操作系统最可能提供更好的硬件支持，开源的Android授权是免费的。]]></description>
			<content:encoded><![CDATA[<div id="attachment_19" class="wp-caption alignleft" style="width: 310px"><img class="size-full wp-image-19" title="android" src="http://www.poemcode.net/wp-content/uploads/2008/12/android.jpeg" alt="android" width="300" height="220" /><p class="wp-caption-text">android</p></div>
<p><em>以下资讯部分译自<a title="Android to take linux mainstream" href="http://www.zdnetasia.com/news/software/0,39044164,62051862,00.htm" target="_blank">ZDNetAsia</a>。</em></p>
<p>一个操作系统要想和微软Windows争夺市场份额，它需要两个东西：操作系统开发商的支持和廉价的许可费。</p>
<p>近期，由Google支撑的Android系统被“非官方”移植到Asus Eee PC上网本，根据报告，台湾制造商已经成了一个小组来开发运行在基于Linux操作系统的上网本。</p>
<p>Daiwa Securities的分析员Calvin Huang在一次采访中告诉ZDNet，Android在几个方面能够“杀死微软”：有大公司撑腰的操作系统最可能提供更好的硬件支持，开源的Android授权是免费的。</p>
<p>Calvin Huang 说：“没有强有力的支撑，Linux只是一个小众的平台。现在Google的支撑，Android有了更好的机会从微软一方争夺用户”</p>
<p>Google开发人员认为，Android和其他linux平台的区别就是Dalvik虚拟机。它为程序员提供了一个层，使得程序员不用担心部署Android的下层硬件。</p>
<p>现在经济危机也可能在促使制造商转入Android过程中，扮演角色。Huang补充：“授权费确实关系很大，制造商并不愿意为微软缴税。Android上网本明确比Windows上网本成本低。”</p>
<p>但是，还是存在用户接受的问题。</p>
<p>包括Asus的Eee PC和MSI的MSI的Wind在内,好几款上网本最初是搭载了Linux操作系统，但是由于消费者的抵触，零售商看到消费者并不喜欢新界面，制造商开始寻求Windows。</p>
<p>但是，Huang认为这是Android的关键时刻。</p>
<p>“用户需要逐步熟悉非Windows操作系统。微软在未来两三年内仍会不错。之后Google就会改变这局面了”Huang说。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.poemcode.net/2009/03/android%e6%88%90%e4%b8%balinux%e4%b8%bb%e6%b5%81/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
