在Ubuntu 上通过ADB 调试Samsung Galaxy Tab Plus P6200 

三星的手机要我怎么说呢?简直就是废品。

自带的新浪天气的插件三天两头挂掉,让人苦不堪言。

我在网上一查,遇到这么情况我只是我一个,还有很多。

所以我决定今天通过ADB(Android Debug Bridge)查看下它的日志,看能不能发现点问题。

然后问题来了。

我发现我的电脑却总是不能识别出P6200,在设备一栏永远是未知,一串问号。

就像这样:

sharl@sharl-laptop:~$ adb devices
List of devices attached
???????????? device


而我的motorola 的里程碑手机从未遇到过这种情况,samsung 这个废品!

不过,骂归骂,问题总是要解决。

经过我的一番研究,终于找到了一个可行的步骤,现分享如下:

首先确认手机与电脑没有建立连接,各自独立。

再确认 adb 进程没有在跑,如果有,杀掉,如下:

sharl@sharl-laptop:~$ killall adb
adb:没有发现操作


紧接着,重启 udev 服务。如下:

sharl@sharl-laptop:~$ sudo service udev restart
udev stop/waiting
udev start/running, process 7632


这时候,打开手机,设置,开启USB调试模式,并用数据线连接至电脑。

之后,查看下USB设备,确认系统已经识别该设备。如下:

sharl@sharl-laptop:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 002 Device 004: ID 0bc2:3300 Seagate RSS LLC
Bus 005 Device 002: ID 08ff:2580 AuthenTec, Inc. AES2501 Fingerprint Sensor
Bus 002 Device 005: ID 062a:8668 Creative Labs
Bus 002 Device 006: ID 1a1d:8301 Veho
Bus 002 Device 067: ID 0ac8:303b Z-Star Microelectronics Corp. ZC0303 Webcam
Bus 002 Device 008: ID 046d:c52e Logitech, Inc.
Bus 002 Device 079: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II]


注:最后一个就是我的P6200.

最后,启动adb 即可。

这样的步骤下来,就可以成功识别出samsung 的手机了。如下:

sharl@sharl-laptop:~$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
46411912F57398CE device


怎么样?再也不是之前的 “????????” 或者是 offline 了。

真尼玛不容易,我察!
[ ] ( 4065 次浏览 ) 永久链接 ( 3 / 2530 )
升级安装 varnish 3.0.3 RC1 和 lighttpd 1.4.31 以及 nginx 1.3.1 

最近我所用到的很多软件都更新了,Varnish Cache 几天前发布了其3.0.3的RC测试版,我有理由试用和反馈。

Lighttpd 也在上周发布了今年的第一个新版本,修复几个严重问题。

nginx 呢,也在昨天,发布了其1.3.x 分支的第二个测试版,修复了一个Windows 下的CVE.这在nginx 官网的安全通告页可以看到:
http://nginx.org/en/security_advisories.html

GNU/Linux 不受影响,不过还是有一些bugfix.具体见更新列表:
http://nginx.org/en/CHANGES

基于此,我决定挨个跟进。

下载源码:
7 wget http://repo.varnish-cache.org/test/varn ... rc1.tar.gz
8 wget http://download.lighttpd.net/lighttpd/r ... 31.tar.bz2
9 wget http://nginx.org/download/nginx-1.3.1.tar.gz

移除旧版本:
[root@PowerPC pub]# rm varnish*
rm: remove regular file `varnish-3.0.2.tar.gz'? y
rm: remove regular file `varnish-3.0.3-rc1.tar.gz'? n
[root@PowerPC pub]# rm lighttpd*
rm: remove regular file `lighttpd-1.4.30.tar.bz2'? y
rm: remove regular file `lighttpd-1.4.31.tar.bz2'? n
[root@PowerPC pub]# rm nginx*
rm: remove regular file `nginx-1.3.0.tar.gz'? y
rm: remove regular file `nginx-1.3.1.tar.gz'? n

挨个解压,列表如下:
[root@PowerPC ~]# ls -lh
total 12K
drwxr-sr-x 6 1000 1000 4.0K Jun 6 16:54 lighttpd-1.4.31
drwxr-xr-x 9 1001 1001 4.0K Jun 6 17:06 nginx-1.3.1
drwxr-xr-x 10 1000 1000 4.0K Jun 6 16:44 varnish-3.0.3-rc1

先从Varnish Cache开始,进入目录:
我的configure:
[root@PowerPC varnish-3.0.3-rc1]# ./configure \
> --prefix=/usr/local/varnish \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig \
> --localstatedir=/var \
> --disable-largefile \
> --enable-kqueue \
> --enable-epoll \
> --enable-ports \
> --with-jemalloc

检查依赖,没有问题。只有一个函数的警告。

configure: WARNING: won't look for sendfile() on i686-pc-linux-gnu


忽略即可。make && make install 编译安装。
恢复配置文件,覆盖自动生成的default.vcl .

接下来 lighttpd,进入目录:
我的configure:
[root@PowerPC lighttpd-1.4.31]# ./configure \
> --prefix=/usr/local/lighttpd \
> --exec-prefix=/usr/local \
> --sysconfdir=/etc/sysconfig/lighttpd \
> --localstatedir=/var \
> --disable-lfs \
> --disable-ipv6 \
> --with-mysql=`which mysql_config` \
> --with-ldap \
> --with-attr \
> --with-pcre \
> --with-zlib \
> --with-bzip2

检查依赖,系统给出编译概况:

Plugins:

enabled:
mod_access
mod_accesslog
mod_alias
mod_auth
mod_cgi
mod_compress
mod_dirlisting
mod_evhost
mod_expire
mod_extforward
mod_fastcgi
mod_flv_streaming
mod_indexfile
mod_mysql_vhost
mod_proxy
mod_redirect
mod_rewrite
mod_rrdtool
mod_scgi
mod_secdownload
mod_setenv
mod_simple_vhost
mod_ssi
mod_staticfile
mod_status
mod_trigger_b4_dl
mod_userdir
mod_usertrack
mod_webdav
disabled:
mod_cml
mod_magnet

Features:

enabled:
auth-crypt
auth-ldap
compress-bzip2
compress-deflate
compress-gzip
regex-conditionals
disabled:
large-files
network-ipv6
network-openssl
stat-cache-fam
storage-gdbm
storage-memcache
webdav-locks
webdav-properties


确认没有问题。make && make install 以继续。
编译安装完成后,恢复下配置文件目录。

最后是 nginx,进入目录:
我的configure:
[root@PowerPC nginx-1.3.1]# ./configure \
> --prefix=/usr/local/nginx \
> --sbin-path=/usr/local/sbin/nginx \
> --conf-path=/etc/sysconfig/nginx/nginx.conf \
> --error-log-path=/var/log/nginx/error.log \
> --pid-path=/var/run/nginx.pid \
> --lock-path=/var/lock/nginx.lock \
> --user=web \
> --group=http \
> --with-rtsig_module \
> --with-select_module \
> --with-poll_module \
> --with-file-aio \
> --with-http_realip_module \
> --with-http_addition_module \
> --with-http_xslt_module \
> --with-http_image_filter_module \
> --with-http_flv_module \
> --with-http_mp4_module \
> --with-http_gzip_static_module \
> --without-http_ssi_module \
> --without-http_geo_module \
> --without-http_map_module \
> --without-http_rewrite_module \
> --without-http_proxy_module \
> --without-http_fastcgi_module \
> --without-http_uwsgi_module \
> --without-http_scgi_module \
> --without-http_limit_conn_module \
> --without-http_limit_req_module \
> --http-log-path=/var/log/nginx/access.log \
> --http-client-body-temp-path=/tmp/nginx/request \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module \
> --with-pcre

同样,检查依赖时系统会给出编译概况:

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin/nginx"
nginx configuration prefix: "/etc/sysconfig/nginx"
nginx configuration file: "/etc/sysconfig/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/tmp/nginx/request"


同样,在确认无误后,开始 编译 和 安装。 make && make install.
之后,恢复配置文件,覆盖生成的 nginx.conf 文件。

注:这里有个小插曲,那就是我在编译nginx 时候,把user 和 group 参数写反了,以至于启动 nginx 后,提示“getpwnam() 和 getgrnam()” 错误。
我又难得再编译一遍,就用"user USER GROUP;"修饰符写死在配置文件里了。囧~

之后启动所有服务,一切正常。
升级结束。
[ ] ( 2116 次浏览 ) 永久链接 ( 2.9 / 2547 )
升级安装 Nginx 1.3.0 和 为PHP 安装启用 APC 模块 

昨天,nginx 发布了其最新开发分支1.3.x 的第一个版本 - 1.3.0。果断升级,并且按照它之前的路线图显示,1.3.x 分支很有可能要增加对 SPDY 的支持。

下载源码包:
36 wget http://nginx.org/download/nginx-1.3.0.tar.gz

移除旧版本:
[root@PowerPC pub]# rm nginx*
rm: remove regular file `nginx-1.2.0.tar.gz'? y
rm: remove regular file `nginx-1.3.0.tar.gz'? n

解压,进入目录:
我的configure :
[root@PowerPC nginx-1.3.0]# ./configure \
> --prefix=/usr/local/nginx \
> --sbin-path=/usr/local/sbin/nginx \
> --conf-path=/etc/sysconfig/nginx/nginx.conf \
> --error-log-path=/var/log/nginx/error.log \
> --pid-path=/var/run/nginx.pid \
> --lock-path=/var/lock/nginx.lock \
> --user=http \
> --group=web \
> --with-rtsig_module \
> --with-select_module \
> --with-poll_module \
> --with-file-aio \
> --with-http_image_filter_module \
> --with-http_flv_module \
> --with-http_mp4_module \
> --with-http_gzip_static_module \
> --without-http_ssi_module \
> --without-http_geo_module \
> --without-http_map_module \
> --without-http_rewrite_module \
> --without-http_proxy_module \
> --without-http_fastcgi_module \
> --without-http_uwsgi_module \
> --without-http_scgi_module \
> --http-log-path=/var/log/nginx/access.log \
> --http-client-body-temp-path=/tmp/nginx/request \
> --without-mail_pop3_module \
> --without-mail_imap_module \
> --without-mail_smtp_module \
> --with-pcre

检查依赖,没有问题。之后系统给出编译概况,如下:

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/sbin/nginx"
nginx configuration prefix: "/etc/sysconfig/nginx"
nginx configuration file: "/etc/sysconfig/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/tmp/nginx/request"


确认无误,make && make install.编译安装之。

之后,恢复配置文件即可.

nginx 升级完成。

接下来,考虑到我的PHP 5.4.0 一直都没有缓存模块,正好趁今天有时间一起搞定。

于是火速动手。

考虑到我以前一直用的eaccelerator,用的还蛮顺手的,故而还是用它。可是丫的已经很长时间没有更新了,SVN 的版本号永远的停留在了r427,最后更新2年前~

从SVN签出源码后,编译一下,居然报错。

奇怪,同样的版本,以前怎么没错?难道是不兼容PHP 5.4 + ?
果然,在它的sf.net 项目主页上,也看到了其他用户的反馈。
详见:http://sourceforge.net/projects/eaccelerator/reviews/

看来 eaccelerator 是指望不上了,好在还有 APC 和 Xcache 可选择。

最终还是选了APC (Alternative PHP Cache),毕竟是 PHP 团队自己在维护,信得过。

下载源码:
wget http://pecl.php.net/get/APC-3.1.10.tgz

解压,进入目录:
执行 phpize,生成 configure 等文件.

我的configure:
[root@PowerPC APC-3.1.10]# ./configure \
> --enable-apc \
> --enable-apc-memprotect \
> --with-php-config=/usr/local/bin/php-config

其实很简单,就是指明 php-config 的绝对路径即可。
之后,make 编译。

编译完成后,其实我要得apc.so 链接库文件已经生成了。
[root@PowerPC APC-3.1.10]# find . -name "*.so"
./.libs/apc.so
./modules/apc.so

直接可以把apc.so 复制到 php 的扩展文件夹下。
或者
通过 make install 安装至其目录。如下:
[root@PowerPC APC-3.1.10]# make install
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20100525/
Installing header files: /usr/local/php/include/php/

最后,编辑 php.ini 配置文件。
加入类似以下的APC 配置项:
extension=apc.so
apc.enabled=1
apc.shm_size=50M
apc.ttl=7200
apc.user_ttl=7200
apc.enable_cli=0

更多参数选项可以参考源码包下INSTALL 文件。

接下来,只需要重启PHP-FPM,就可以载入APC了。

启动所有服务后,查看PHPINFO:
http://cgi.xiazhengxin.name/phpinfo.php

一切OK。
[ ] ( 2478 次浏览 ) 永久链接 ( 3 / 2605 )
在Ubuntu 12.04 上为Virtualbox 启用USB 设备支持 

虚拟机我一直在用,不是说离不开Windows,而是有些时候一些应用在Windows 下体验确实要好一点,比如 Tencent QQ.

最近我找到了我失踪久矣的10moons 左轮摄像头,那还是我在北京念书的时候,在中关村买的。当时花了我100块RMB。

找到后甚是感触,于是便打算给我的虚拟机里面的QQ用起来。

众所周知,VirtualBox 使用宿主机的USB设备需要安装扩展包。根据自己的vbox的版本,到vbox官网下载对应的扩展包。

比如我的vbox 是4.1.12的,对应扩展包地址是:
http://download.virtualbox.org/virtualb ... ox-extpack

下载完毕后,在“管理”菜单下的“全局设定”里的“扩展”标签下,加入、启用即可。

如图:


之后,打开虚拟系统设置,在“USB设备”标签下,勾选上"启用USB控制器"以及"2.0控制器"增加对USB2.0 的支持。

如图:


按说这个时候已经搞定了。可是在USB列表里面却没有任何USB设备。这是为什么呢?谷歌了一下,找到了一篇文章(具体地址已经无法回忆起来了,囧),解释了一下原因。

原来是vbox 所在的用户组比如要包括当前用户才行。

查看当前用户名:
sharl@sharl-laptop:~$ whoami
sharl

查看vbox 所在的组:
sharl@sharl-laptop:~$ cat /etc/group | grep vbox
vboxusers:x:125:sharl

将当前用户加入vbox组:
usermod -a -G vboxusers sharl

即可。

此时,重启系统。再次打开虚拟机,果然,USB设备都已经被识别、访问到了。
这些,在“设备”菜单下就可以看到。

如图:


添加后,虚拟机系统果然发现了新硬件,按照一般步骤,安装驱动即可正常使用。

安装后的10moons 摄像头,果然很给力。

如图:


完。

注:本文在撰写和实践时参考了国外某网站一篇文章,由于记录不善,地址目前不详。模糊记得当时使用了“Ubuntu Virtualbox add usb device” 等关键词。
[ ] ( 2315 次浏览 ) 永久链接 ( 3 / 2666 )
在CentOS 上利用预编译源安装 nginx 和 cherokee 

昨天偶尔从我的一个朋友那里得到了一个闲置的VPS,故而就想尝试一些小想法,一直没敢在自己的VPS上做的操作。

早就听说nginx 提供预编译版本,早就想试试了。还有 cherokee 也是。

不过和nginx 不同的是,cherokee 的预编译包是由EPEL维护和提供的。

果断下载其库的rpm 包,地址在它们的官网都可以找到。
3 wget http://mirrors.sohu.com/fedora-epel/6/i ... noarch.rpm
13 wget http://nginx.org/packages/centos/6/noar ... noarch.rpm

下载文件如下:
[root@ymzx ~]# ls -lh
总用量 24K
-rw-r--r-- 1 root root 14K 10月 14 2010 epel-release-6-5.noarch.rpm
-rw-r--r-- 1 root root 4.3K 10月 14 2011 nginx-release-centos-6-0.el6.ngx.noarch.rpm

依次安装。
[root@ymzx ~]# rpm -i --nosignature epel*
[root@ymzx ~]# rpm -i --nosignature nginx*

必须要加 --nosignature 参数,跳过签名检验,否则会报以下错:

warning: epel-release-6-5.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY


安装完成后,会发现yum 的库多了几个文件,
[root@ymzx ~]# ls -lh /etc/yum.repos.d
总用量 28K
-rw-r--r-- 1 root root 1.9K 7月 3 2011 CentOS-Base.repo
-rw-r--r-- 1 root root 637 7月 3 2011 CentOS-Debuginfo.repo
-rw-r--r-- 1 root root 626 7月 3 2011 CentOS-Media.repo
-rw-r--r-- 1 root root 957 10月 12 2010 epel.repo
-rw-r--r-- 1 root root 1.1K 10月 12 2010 epel-testing.repo
-rw-r--r-- 1 root root 113 10月 14 2011 nginx.repo
-rw-r--r-- 1 root root 219 7月 26 2011 vz.repo

就是 nginx 和 epel 的。

接下来,就可以在 yum 里面搜索到 nginx 和 cherokee 了。

[root@ymzx ~]# yum search nginx cherokee
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.san.fastserv.com
* epel: linux.mirrors.es.net
* extras: mirror.san.fastserv.com
* updates: mirrors.usc.edu
=============================================================== Matched: nginx ===============================================================
nginx-debug.x86_64 : debug version of nginx
nginx-release-centos.noarch : nginx repo configuration and pgp public keys
collectd-nginx.x86_64 : Nginx plugin for collectd
nginx.x86_64 : high performance web server

============================================================= Matched: cherokee ==============================================================
cherokee-devel.i686 : Development files of cherokee
cherokee-devel.x86_64 : Development files of cherokee
cherokee.i686 : Flexible and Fast Webserver
cherokee.x86_64 : Flexible and Fast Webserver

依次 yum install NAME 安装即可。

怎么样?是不是很简单,快捷?
[ ] ( 2275 次浏览 ) 永久链接 ( 2.9 / 2721 )

<< <上一页 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 下一页> >>