ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

顯示具有 administration 標籤的文章。 顯示所有文章
顯示具有 administration 標籤的文章。 顯示所有文章

2015年6月29日 星期一

nc : netcat 多功能 , 這次用來傳檔

ref: http://nakkaya.com/2009/04/15/using-netcat-for-file-transfers/

測試 usb ncm, 所以 adb 就不能用了,
host pc 和 android 用 ncm 連起來。

這時後要傳檔,android 上又沒有 ftp, ssh server.
就用最簡單的netcat.
Usage: nc [-iN] [-wN] [-l] [-p PORT] [-f FILE|IPADDR PORT] [-e PROG]

Open a pipe to IP:PORT or FILE

    -l      Listen mode
    -p PORT local port
    -w SEC  connect timeout
    -i SEC  delay interval for lines sent
    -f FILE use file (ala /dev/ttyS0) instead of network
    -e PROG Run PROG after connect

送和收都用 nc

先啟動收..
# nc -l -p 1234 > /system/bin/mytool

然後送的...
$ nc -w 3 192.168.200.2 1234 < ./mytool

2015年5月19日 星期二

ntp server

ntp server 是一個階層式的設計。
每一個 ntp server 都會說明他的時間的 "源頭".
源頭可以是 GPS, 原子鐘等硬體。
也可以是另一台 ntp server.

根據時間的取得來源,代表ntp server 的時間是第一手(直接的硬體 GPS, 原子中..),
或是第二手 (令一個 ntp server).
ntp server 有一個參數叫 stratum
stratum = 1 就是第一手。
2 就是第二手。



在 ntp.conf 裡。
要設定 時間的 "源頭"..
一般都是設定 "上一手" 的 ntp server.
所以就是用 server 列出:
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst
這個範例列出他的上游 ntp server 有四個。
ntp daemon 會自動找出最適合的 server 來同步。

另外,如果要使用自己的hw clock, 就要用:
server 127.127.1.0
說明跟自己拿時間。
又因為這樣就沒有說明是第幾手,所以要加令一個command:
fudge 127.127.1.0 stratum 10
說明自己hw color 是第 10 手。

ntp daemon 基本上會去一一詢問這些 server, 然後決定使用那一個 server 的資料。
同時詢問 server 的 stratum (第幾手) number.
好決定自己的 stratum number.

像上游stratum 是 2, 自己就是 3.


ntp.conf 設好以後, service ntp restart 就可以重新啟動 ntp server
ntp server package 提供一個 tool 來看 ntp server 資料。

$ ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 91.189.89.199   .STEP.          16 u    - 1024    0    0.000    0.000   0.000
*192.168.144.248 59.124.29.241    3 u   16   64  377    0.115   48.283  12.243
 127.127.1.0     .LOCL.          10 l    4   64  377    0.000    0.000   0.001

-p 是 peer
-n 是 show ip address.

可以看到 remote 列出在 ntp.conf 中 server 的列表。
refid 是他的上游 ntp server.
所以 .LOCAL. 就是自己的 hw clock.
.STEP 好像是 sync fail

st 是 stratum ,可以看到 sync fail 的, stratum 是 16

第二個 server 前面有一個 * 符號。
代表 ntp server 決定使用這一個 server 的資料。-- (所以自己的 stratum 就是 4)

當 ntp service 剛剛啟動,* 不會出現,大約需要 5 ~ 10 min 才會決定。
當有 * 出現時, ntp server 才會正常回應 ntp client 的 要求。


測試

可以用 ntpdate 來測試。
$ ntpdate -q 127.0.0.1
server 127.0.0.1, stratum 4, offset -0.000003, delay 0.02562
19 May 17:45:59 ntpdate[4599]: adjust time server 127.0.0.1 offset -0.000003 sec
問自己..

要是出問題,可以用 -dv 列出debug information


ref:
  • http://markelov.org/wiki/index.php/NTP._Server_dropped:_strata_too_high
  • http://docs.oracle.com/cd/E26996_01/E18548/html/manager_ntpconfig.html
  • http://en.linuxreviews.org/NTP_-_Howto_make_the_clock_show_the_correct_time
  • http://www.geego.com.tw/technical-discussion-forum/tech-tips-centos-ntp-server-%E6%9E%B6%E8%A8%AD%E5%BF%83%E5%BE%97

client

client 只要安裝 ntpdate .
他同時會修改 /etc/network/if-up.d/ntpdate
這樣在network up 時,會自動執行 ntpdate 更改時間。

ntp server.. sync to hw clock

只是想讓一些像 raspberry pi, banana pi 這樣沒有 RTC 的板子在每次斷電開機後,可以有正常的時間。
(這樣做 file operation, make 等才不會有 complain).

所以想在 lan 中放一個 ntp server.
因為很倒楣的是,firewall 屏蔽掉 ntp udp port。
所以只能以某台server 的 hw clock 作為 ntp server 的同步時間。

server:

就莊 ntp 就可以。
然後修改 /etc/ntp.conf

因為會被 blocking, 所以 sync 的 ntp server 隨便寫。
但是要使用自己的 hwclock 作為 sync time,
就要加上:
server 127.127.1.0
fudge 127.127.1.0 stratum 9
server 127.127.1.0 說明自己也是 time server.
其中的 fudge 說明自己是 stratum 9.
這樣,自己的 hw clock 就會是一個stratum (位階) 9 的 ntp server.

ntp.conf 的修改,基本上不需要動。
只有 server list 要調整。
因為已經有各 distribution 基本的 server list, 所以不用動也可以。

在local lan 因為 firewall 擋住,所以所有的 ntp server 都無法 sync..
所以只會sync 到 LOCAL.



ref:
  • http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html
  • http://en.linuxreviews.org/NTP_-_Howto_make_the_clock_show_the_correct_time#What_the_fudge.3F

2015年1月8日 星期四

Chrome on Jessie -- 環境變數問題

發現在panel 新增一個 chrome button , lunch chrome 的話,他好像吃不到環境變數 (proxy, no_proxy).
但是開 console, 直接launch chrome, 他又吃得到。

我的 http_proxy 是設定在 system setting 中。
所以開啟 console 會顯示出來。

後來改了,在 .profile 中加上。
這樣,chrome button 啟動的 chrome 也吃得到了...

2014年12月19日 星期五

crossmnt : nfs mount 包含 server mount 的內容

用途:

當 nfs mount server 的目錄下,有mount 其他的 partition 時。
client 端往往只能看到空目錄,不會看到 server mount partition 的內容。

如果要讓 client 也能看到 server mount 的內容。

就要:
  • server 把 mount partition 的 path 也 export (再一次)
  • 那個 partition 的 parent folder 在 exports 裡的宣告,要加上 crossmnt 這個 option


ref: http://unix.stackexchange.com/questions/42131/how-to-properly-export-and-import-nfs-shares-that-have-subdirectories-as-mount-p

2014年12月2日 星期二

install run-java6 on Debian Jessie

去 http://ghaffarian.net/downloads/Java/JDK/ 下載 jdk-6u45-linux-x64.bin (因為到 oracle 下載要註冊).

ref: http://unix.aspcode.net/view/635395087004115229152482/install-java-sdk-6-wheezy

debiand 沒辦法直接提供 oracle java package (因為 license),但是提供了把 Orcale java 包裝成 deb 的 tool:
apt-get install java-package
包裝 jdk-6u45-linux-x64.bin:
make-jpkg jdk-6u45-linux-x64.bin
安裝剛剛包好的 deb:
dpkg -i oracle-java6-jdk_6u45_amd64.deb

Selecting previously unselected package oracle-java6-jdk.
(Reading database ... 169950 files and directories currently installed.)
Preparing to unpack oracle-java6-jdk_6u45_amd64.deb ...
Unpacking oracle-java6-jdk (6u45) ...
Setting up oracle-java6-jdk (6u45) ...
update-alternatives: using /usr/lib/jvm/jdk-6-oracle-x64/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode
update-alternatives: using /usr/lib/jvm/jdk-6-oracle-x64/jre/lib/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode

會裝在 /usr/lib/jvm/jdk-6-oracle-x64

然後就是設定 default :
sudo update-java-alternatives -s jdk-6-oracle-x64
然後會 complain 一下 這個 folder 有一些 tool 沒提供。

2014年11月26日 星期三

mount partition and the owner

mount partition 的時候,mount folder 的 ower 依據 partition 的 filesystem 而有不同的決定方法。
像沒有 owner attr 的 filesystem, 像 fat。
就可以在 mount 的時候指定 uid, gid

如果是本來就有 ower attr 的 filesystem, 像 ext4
就是由 partition 的 root attrib 決定的。

像 mount ext4 進來後,到 mount folder 的 root 去看 (ls -al)

那個 . 的 owner 是誰,就決定 mount folder 的 owner 是誰。

2014年11月13日 星期四

sfdisk . script fdisk.

create_partition(p, 1, +5M)...
create_partition(p, 2, +30M)...
create_partition(p, 3, +160M)...
create_partition(e, 4, +all)...
create_partition(l, 5, +100M)...
create_partition(l, 6, +512M)...
create_partition(l, 7, +1024M)...
create_partition(l, 8, +all)
寫成 sfdisk 的 script 的話是....

start, size, id, bootable

FT2323R vid 0403 pid 0000 driver

[14771.500536] usb 3-1.4: new full-speed USB device number 8 using xhci_hcd
[14771.959368] usb 3-1.4: New USB device found, idVendor=0403, idProduct=0000
[14771.959374] usb 3-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[14771.959378] usb 3-1.4: Product: FT232R USB UART
[14771.959381] usb 3-1.4: Manufacturer: FTDI
[14771.959384] usb 3-1.4: SerialNumber: A92X933R
這個 usb-serial driver 已經內建在 kernel 理了 /lib/module/`uname -r`/kernel/drivers/usb/serial/ftdi_sio

但是大概因為這個 chip 是新的,所以不會自己 load

ref: https://bbs.archlinux.org/viewtopic.php?id=175499

先 load ftdi_sio ,之後再把 0403 0000 寫入 new_id:
# modprobe ftdi_sio
# echo 0403 0000 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id 

這樣之後...
[16240.939782] usbcore: registered new interface driver usbserial
[16240.939807] usbcore: registered new interface driver usbserial_generic
[16240.939827] usbserial: USB Serial support registered for generic
[16240.950945] usbcore: registered new interface driver ftdi_sio
[16240.950969] usbserial: USB Serial support registered for FTDI USB Serial Device
[16281.458752] usbserial: USB Serial deregistering driver FTDI USB Serial Device
[16281.458807] usbcore: deregistering interface driver ftdi_sio
[16580.239129] usbcore: registered new interface driver ftdi_sio
[16580.239174] usbserial: USB Serial support registered for FTDI USB Serial Device
[16660.940658] ftdi_sio 3-1.4:1.0: FTDI USB Serial Device converter detected
[16660.940749] usb 3-1.4: Detected FT232RL
[16660.940754] usb 3-1.4: Number of endpoints 2
[16660.940758] usb 3-1.4: Endpoint 1 MaxPacketSize 64
[16660.940762] usb 3-1.4: Endpoint 2 MaxPacketSize 64
[16660.940766] usb 3-1.4: Setting MaxPacketSize 64
[16660.941420] usb 3-1.4: FTDI USB Serial Device converter now attached to ttyUSB0
就出現 ttyUSB0 了。

又因為 ftdi_sio 已經load在 kernel,所以拔掉 後再插一樣會動作。

2014年11月12日 星期三

Test Install Jessie ..

因為 nb 夠新,所以把 iso copy 到 /dev/sdX (usb) 就可以開機。
開機按 F12, 選 usb

直接裝 jessie 沒辦法開機。
所以裝 wheezy,記得 grub 要裝到 usb 上,不要裝在 mbr 上。
一開始選安裝target 時要寄一下是 /sdX,因為後來裝 grub 時,要寫,,,,

system time 是 UTC 沒錯 (有問?)
裝完 OK

然後改 sources.lst ,把 wheezy 改 jessie, update, dist-upgrade (超久,約 2hrs)。
開機 OK

裝 mate -- 一堆,結果開機一樣進 gnome3。
follow instruction 把 gnome* remove.
然後裝 lightdm

重開,出現不一樣的login 畫面。
進入是最基本的 WM. 所有 windows 都沒有邊框。
猜是因為 remove gname* 的關係。

network 也沒啟動,只好手動 加 /etc/network/interface 的 eth0

裝 network-manager-gnome.

這樣大概用了 4.7 G


not sure if it's OK, just a command log:

sudo apt-get install git gnupg flex bison gperf build-essential   zip curl libc6-dev libncurses5-dev x11proto-core-dev   libx11-dev libreadline6-dev libgl1-mesa-glx   libgl1-mesa-dev g++-multilib mingw32 tofrodos   python-markdown libxml2-utils xsltproc zlib1g-dev

libz.so.1:   lib32z1 lib32ncurses5

add squeeze main non-free, install sun-java6-jdk -- not work, break a lot packages dependency.
add wheezy main, install openjdk-6-jdk, downgrade jre to 6
sudo update-alternatives --config java


正式安裝。

裝在 HD 上,用 jessie Oct.5 的 image 直接安裝就可以。
將 iso dd 到 usb 上,開機近bios 選 startup..當插兩隻 usb 時,如果開機順續錯,就交換。
usb 3.0 port 的 boot pri 好像比較高。
proxy 時,要用 http://192.168.100.132:3128
不可以家字串符號,也不可以不加 http
裝完也可以開機。

所以可以直接選 MATE, 不要gnome.

先是時間,這次沒看到問 UTC還是 local,就直接用 UTC 了。
但是因為 bios 是 local,所以時間是錯的。

有說從 wheezy 開始,不要用 rcS 設定 UTC=yes/no 了。
要改用 /etc/adjtime

但是這個 adjtime 要用 hwclock 產生。
不可以自己 edit。

查一下,系統沒有這個檔。

hwclock 產生 /etc/adjtime 的方法就是用 hwclock 設定一次時間。
sudo hwclock --set --localtime --date "07 Nov 2014 14:39:55"
這樣 /etc/adjtime 就產生了。
因為有指定 localtime,所以是把 RTC 當 localtime 用。

很奇怪,改完 bios 時間竟然變了,只好重新設定 bios, 之後就 OK 了。

中文輸入。

MATE 很陽春,沒有 input config.
所以就裝了 scim 和 scim-chewing

裝完就出現 scim 和 config-input,
用 config-input 選 scim,default 也選 scim。
然後 follow : http://blog.roodo.com/rocksaying/archives/31556973.html
dpkg-reconfigure locales, 選 zh_TW,UTF-8

重開機,status bar 出現 keyboard,已經可以用 ctrl-space 切換輸入法了。


自動登入/autologin

MATE 是用 lightdm,所以 config 是 /etc/lightdm
follow https://wiki.debian.org/LightDM
修改 /etc/lightdm/lightdm.conf
-#autologin-user=
-#autologin-user-timeout=0
+autologin-user=checko-chang
+autologin-user-timeout=3


fix: lightdm 不會 run .profile

ref: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/oneiric/lightdm/oneiric/revision/10
方法就是..叫 lightdm 啟動後去 run 一個 script,然後那個 script 去 run .profile..
一樣修改 /etc/lightdm/lightdm.conf:
diff --git a/lightdm.conf b/lightdm.conf
index 49f7d9f..fc5163c 100644
--- a/lightdm.conf
+++ b/lightdm.conf
@@ -105,7 +105,7 @@
 #allow-user-switching=true
 #allow-guest=true
 #guest-session=
-#session-wrapper=lightdm-session
+session-wrapper=/etc/lightdm/Xsession
 #greeter-wrapper=
 #guest-wrapper=

然後加上這個 Xsession:

wifi/BCM43228

就 follow wheezy 的安裝方法..https://wiki.debian.org/wl#Debian_7_.22Wheezy.22
但是做完,modprobe 時竟然說找不到 wl 這個 module.

回頭看一下 安裝的 log, 好像說,因為 kernel header 與 kernel 版本不符,所以skip build module 的動作。
找一下 install 的 kernel 版本 (uname -a) 是 3.16-2
但是安裝的 kernel header 版本是 3.16-3

做 apt-get update, apt-get upgrade 看到,.. hold back 項目有 kernel-image
改用 aptitude upgrade 竟然就安裝了...
重開機後,果然變成 3.16-3

purge 後再 install broadcom-sta-dkms, 果然就開始 build module

完成後 modprobe wl 也 OK

然後再 top banner 的網路 panel. 就出現 wifi, 一些 AP 出現,可以連線了。

裝 gconf-editor
沒用。


裝 chrome, 要 libappindicator1

proxy 認錯,所以要用command line 啟動。看一下 man google-chromd

git difftool readonly

ref: http://stackoverflow.com/questions/18544238/how-to-prevent-git-vimdiff-from-opening-files-as-read-only
就是 create 一個 .vimrc,裡面是:
:set noro

就可以了。
另外,要 set vimdiff 為 git diff 的 tool ,可以用 command:
git config --global diff.tool vimdiff  
git config --global difftool.prompt No


Build Android

缺 libmpc.so.2 -- 裝 libmpc2
缺libgmp.so.3 -- 沒辦法解,只好到其他的系統 (ubuntu 12.10 amd64), copy libgmp.so.3 到 /usr/lib

然後是 "mixed implicit and normal rules: deprecated syntax"
這個 ref: http://stackoverflow.com/questions/9356735/makefile-rule-error-mixed-implicit-and-normal-rules

我的 case 是:
all %:
        $(SILENT)for dir in $(KBUILD_SUBDIRS); \
        do \
        ,,,
根據 ref 的說法,是 target 包含 explicit(all) 和 implicit (%)。是不行的,
所以猜開兩個,。就是方開寫 (copy):
all:
     $(SILENT) for dir in ...

%:
     $(SILENT)for dir in ,..


make 4.x 的沒辦法 make gingerbread, 只好copy 其他機器的舊版 make 回來,放到 bin/ 下。
-- jessie 的 lighdm 有問題,部會 run .profile,所以要自己 run..

然後一樣,build fail, 要裝 xutils-dev, lib32z1-dev (不然 ld 會說找不到 -lz), lib32ncurses (ld 5找不到 lncurses), lib32readline6-dev

jessie 的 gcc 版本是 4.9 和 4.8。

一樣,要裝 4.4 (for 2.3).
裝完後 一樣。 (ref: http://r40eubuntu.blogspot.tw/2013/11/wheezy-dell-n1418.html)
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.9
手動建 link /usr/include/x86_64/zconf.h 到 /usr/include


然後是那個 weak point assgined to ... public 問題,google 起來是 openjdk 與 sunjdk 不相容的地方。
如果不想改 sun jdk 的話,只好把發生這個 error 的 cts/Android.mk MARK 調..

改 sun jdk 比較麻煩,因為還要改用舊版 jdk6. ref: http://r40eubuntu.blogspot.tw/2014/12/install-run-java6-on-debian-jessie.html


某版 build uboot 說..
/home/charles-chang/17.2.14/boot/uboot/lib/rsa/rsa-sign.c:12:25: error: openssl/rsa.h: No such file or directory
/home/charles-chang/17.2.14/boot/uboot/lib/rsa/rsa-sign.c:13:25: error: openssl/pem.h: No such file or directory
...
本來以為是沒有指到正確的 android/external/openssl
結果竟然是 host 的問題。
$sudo aptitude install libssl-dev
就 OK 了


接著是 make android 後面:
linux-x86/sign/mkimage: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory
make: *** [android-recovery] Error 127

查一下,系統的是 .../x86_64-linux-gnu/libssl.so.1.0.0

所以到舊 server 去...copy libssl.so.0.9.8

之後是缺 libcrypto.so.0.9.8


然後是 flash.sh, 新的 fdisk 不吃 tab, 不會自動律調。
所以用
echo "n
p
1

+32M
wq " | fdisk -c -u /dev/sdc
這樣的 command,左邊要對齊。

還是不行耶,jessie shell script 好像會有點重疊。
所以只好改用 ..
echo -e 'n\np\n1\n\n+32M\nwq" | fdisk
這樣的寫法,並且為了減少重疊,把所有 command 都準備好之後再一次使用 fdisk

format 出問題:
常常 format 到 partition 6 的時候出現 resource busy, 所以 part size 是 0 的狀況。
加 delay 也沒用。

結果,把所有 &t;null 都拿掉,吐出所有 message 後,就 OK 了。


adb permission denied

就 follow google 那一篇: http://developer.android.com/tools/device.html
在 /etc/udev/rules.d/ 下新增一個 file : 50-android.rules:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" 

然後記得自己要在 plugdev 這個 group 李。
改完重開機就可以。

後來令一個 2.3 板的 竟然 idVendor 不一樣,所以再加一行就可以:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"


sudo no password

ref: http://askubuntu.com/questions/192050/how-to-run-sudo-command-with-no-password/443071#443071

就是改:
# Allow members of group sudo to execute any command
#%sudo  ALL=(ALL:ALL) ALL
%sudo ALL=(ALL) NOPASSWD:ALL

2014年11月10日 星期一

debian jessie MATE disable Automount

要先安裝 dconf-editor,
然後 run dconf-editor

在 mate/desktop/media-handling/automount uncheck

2014年5月15日 星期四

在gnome 3 (Wheezy) 的 application list 中加入新莊的 application

ref: http://blog.randell.ph/2011/08/01/how-to-create-custom-application-launchers-in-gnome-3/

大概就是利用 alacarte ( Main Menu) 的新增 功能。

在 gnome (腳) -- System Tool -- Main Menu
就會啟動 alacarte.

然後選你要的 category, 選右邊 New Item,
接著就跟以前一樣了..

2013年11月6日 星期三

adb shell ls 顯示亂碼

只有在 windows 系統cmd上用 adb 才會有這個問題。
是 shell 的color code 導致。
windows cmd 不認識這個。

解決方法就是叫 shell 不要使用 color:
# export LS_COLORS=none

可以寫在 init.rc 裡。

ref: http://forum.geeksphone.com/index.php?topic=1093.0

2013年10月28日 星期一

e2fsck show progress bar

e2fsck .. 可以用 -C 叫他show progress bar

如果已經在 run 了,
可以不用停掉他,就用
sudo killall -USR1 e2fsck
叫他 show progress bar

2013年7月29日 星期一

已經offline 的 ubuntu 版本的 repo 集散地 : old-releases.ubuntu.com

ubuntu 改版的速度很快,所以一些不是 LTS 的版本,一下子就下架了,
repository sever 也移除了。

如果還有舊的 server,仍然使用這些下架版本,要apt-get install 新 package 就會 fail。

這時候就要改一下 source.list

ubuntu 把這些下架,不再mantain 的 版本都放在: old-releases.ubuntu.com

以 10.10 (maverick) 為例,把 sources.list 改成:
deb http://old-releases.ubuntu.com/ubuntu/ maverick main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ maverick-security main restricted universe multiverse


ref: Old Repository Ubuntu 10.10 Maverick Meerkat

2013年5月10日 星期五

Rainbow Tables -- 平衡的 "運算--查表" 式 暴力破解法

新同學給的:(总结)密码破解之王:Ophcrack彩虹表(Rainbow Tables)原理

這個好厲害,是暴力破解法耶。
適當的利用 cpu mips 縮減 "暴力table" 的 size 到合理大小。

2012年6月22日 星期五

SD card 的 cid

在 /sys 裡: cat /sys/block/mmcblk0/../../cid
因為 /sys 這個 node 是 ln,所以用 ../../


ref: http://stackoverflow.com/questions/3348643/how-to-read-the-sd-card-id-number

2012年2月14日 星期二

D-Link HSPDA Dongle - DWN-156

會先出現 cd rom,然後要切 modeswitch,才會出現 serial port。
在 windows 上會出現三個 serial port (其中一個是 USB Modem):
  1. D-Link HSPDA DataCard Diagnostics Interface
  2. D-Link HSPDA DataCard NMEA Device
  3. D-Link HSPDA DataCard Propertiery USB Modem

這又是一個 有 usb cdrom 模式的 3g dongle。
剛插入系統,會是 cd rom。
要先 switch 到 modem 後,才會出現 usb serial。

剛插入時,vid , pid 是:
New USB device found, idVendor=07d1, idProduct=a804
mount 再 umount 後,vid, pid 是:
New USB device found, idVendor=07d1, idProduct=7e11
但是這時後也沒有出現 usb serial port。



大概用兩個步驟:
  1. usb-modeswitch, 切換到 modem mode
  2. 手動 load usb-serial ,指定 vid, pid

usb-modeswitch:

debian 已經有安裝,但是 /etc/usb_modeswitch.d/ 下面沒有 07d1:a804 的設定檔,
所以要寫 /etc/usb_modeswitch.d/ 下的 vid:pid 檔:
sudo vi /etc/usb_modeswitch.d/07d1:a804 ######################################################## # D-Link DWM-156 HSUPA 3.75G USB Modem DefaultVendor= 0x07d1 DefaultProduct=0xa804 TargetVendor= 0x07d1 TargetProduct= 0x7e11 MessageContent="5553424312345678000000000000061b000000020000000000000000000000" CheckSuccess=20 寫好就可以用 usb_modeswitch 來切了..

先插入 dwn-156, dmesg 內容是: [25387.281621] usb 2-1.1.4.2: new high speed USB device using ehci_hcd and address 19 [25387.391940] usb 2-1.1.4.2: New USB device found, idVendor=07d1, idProduct=a804 [25387.391946] usb 2-1.1.4.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4 [25387.391950] usb 2-1.1.4.2: Product: D-Link WCDMA Technologies MSM [25387.391954] usb 2-1.1.4.2: Manufacturer: D-Link,Incorporated [25387.391957] usb 2-1.1.4.2: SerialNumber: MF112DDLKD010000 [25387.392114] usb 2-1.1.4.2: configuration #1 chosen from 1 choice [25387.394534] scsi16 : SCSI emulation for USB Mass Storage devices [25387.394655] usb-storage: device found at 19 [25387.394659] usb-storage: waiting for device to settle before scanning [25392.392130] usb-storage: device scan complete [25392.392810] scsi 16:0:0:0: CD-ROM HSPA USB SCSI CD-ROM 2.31 PQ: 0 ANSI: 2 [25392.397282] sr1: scsi-1 drive [25392.397481] sr 16:0:0:0: Attached scsi CD-ROM sr1 [25392.397632] sr 16:0:0:0: Attached scsi generic sg4 type 5 用 usb_modeswitch 來切換 mode: $ sudo usb_modeswitch -c /etc/usb_modeswitch.d/07d1:a804 Looking for target devices ... No devices in target mode or class found Looking for default devices ... Found devices in default mode or class (1) Accessing device 022 on bus 002 ... Using endpoints 0x01 (out) and 0x81 (in) Using endpoints 0x01 (out) and 0x81 (in) Inquiring device details; driver will be detached ... Looking for active driver ... OK, driver found ("usb-storage") OK, driver "usb-storage" detached SCSI inquiry data (for identification) ------------------------- Vendor String: HSPA Model String: USB SCSI CD-ROM Revision String: 2.31 ------------------------- USB description data (for identification) ------------------------- Manufacturer: D-Link,Incorporated Product: D-Link WCDMA Technologies MSM Serial No.: MF112DDLKD010000 ------------------------- Setting up communication with interface 0 ... Using endpoint 0x01 for message sending ... Trying to send message 1 to endpoint 0x01 ... OK, message successfully sent Resetting response endpoint 0x81 Resetting message endpoint 0x01 Checking for mode switch (max. 20 times, once per second) ... Waiting for original device to vanish ... Waiting for original device to vanish ... Original device can't be accessed anymore. Good. Searching for target devices ... Found correct target device Mode switch succeeded. Bye.
看一下 dmesg: [38715.226573] usb 2-1.1.4.2: new high speed USB device using ehci_hcd and address 23 [38715.337316] usb 2-1.1.4.2: New USB device found, idVendor=07d1, idProduct=7e11 [38715.337321] usb 2-1.1.4.2: New USB device strings: Mfr=3, Product=2, SerialNumber=4 [38715.337324] usb 2-1.1.4.2: Product: D-Link WCDMA Technologies MSM [38715.337327] usb 2-1.1.4.2: Manufacturer: D-Link,Incorporated [38715.337329] usb 2-1.1.4.2: SerialNumber: MF112DDLKD010000 [38715.337460] usb 2-1.1.4.2: configuration #1 chosen from 1 choice
已經切換了。

然後動 load usb-serial module,指定 vid,pid sudo modprobe usbserial vendor=0x07d1 product=0x7e11
dmesg 可以看到 ttyUSB 出現: [38715.339951] usbserial_generic 2-1.1.4.2:1.0: generic converter detected [38715.340069] usb 2-1.1.4.2: generic converter now attached to ttyUSB0 [38715.340178] usbserial_generic 2-1.1.4.2:1.1: generic converter detected [38715.340280] usb 2-1.1.4.2: generic converter now attached to ttyUSB1 [38715.340537] scsi20 : SCSI emulation for USB Mass Storage devices [38715.340695] usb-storage: device found at 23 [38715.340699] usb-storage: waiting for device to settle before scanning [38715.340788] usbserial_generic 2-1.1.4.2:1.3: generic converter detected [38715.340889] usb 2-1.1.4.2: generic converter now attached to ttyUSB2 [38720.337127] usb-storage: device scan complete

這時候,在 panel 的 network widget 就可以看到 "Chungwha Telecom..",
打勾 就可以連上了。



ref: http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=817&sid=e08d0632f3a91e6379a0367bd258809c

2012年1月30日 星期一

dell N4010 : enable bluetooth

Dell N4010 的 bluetooth 是 Bus 001 Device 008: ID 413c:8160 Dell Computer Corp. Wireless 365 Bluetooth 但是不知道為什麼,在 ubuntu 下 lsusb 沒有出現,只有出現 他的 usb hub : Bus 001 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth) 猜是沒有 enable,但是 bluetooth enable 。
而且 debian 的 dell hotkey 沒有 support wireless (wifi, bt) 的 switch。

所以,只好..

開到 windows 7 下, enable bluetooth,重新開到 debian ...

bluetooth 出現了...

2012年1月5日 星期四

3gdongle on linux & android, some notes

中華電信的某種 帳戶 服務 ,在 android 上有點奇怪。

APN 只能使用 "internet" 的 simcard。

一旦設定使用 "emome" 這個 apn name,data channel 無法連上 (這是當然的),
但是把 apn 改回 internet,也是一樣無法連上,
重開機也一樣。

結果是用 3g dongle,接上 linux,手動撥接..
第一次:撥接 OK,但是ppp 連線,取得 dns 位址時,一直得到 fake 的 10.11.12.13 和 14,
pppd keep retry,還是一樣。
... 猜 android 手機大概是維持在這個狀態。

之後m,再差拔一次 3g dongle,
再 撥接一次才OK。

之後,放在 android 手機上也 OK 了。


  1. 手機是 nexus S
  2. 在改apn name 為 emome ,無法連線,之後有作一次 "恢復 default setting" 的 apn setting
  3. 還有作過 "搜尋可用網路",也無效

標籤

網誌存檔