Flucard firmware 3.24と3.65のファイル上での違い

バイナリファイルは結構違うようだけど、とりあえず、それは置いておく
それ以外の違いについて調べた

/etc/init.d/rcS における差

・読み込むモジュールが変わった

冒頭で「ka2000-sdhc.ko」を読み込む(以前はコメントアウトされていた)

-#insmod /lib/ka2000-sdhc.ko
+insmod /lib/ka2000-sdhc.ko

中盤で読み込んでいた「gpio_i2c.ko」を読み込まなくなった。

-insmod /lib/gpio_i2c.ko
-#sleep 1
+#insmod /lib/gpio_i2c.ko

・自動wifi起動関連の処理が入った

+is_prevent_auto_start_wifi=no
+
+get_config -p "Auto Start Wifi"
+original_auto_wifi_value=`cat /param_value.txt`

など

・/mnt/sd/autorun.shというファイルがあるときは自動wifi起動が実行されない
という設定を入れられている。

 # autorun.sh from sd in case need to perform some test mode
 if [ -f /mnt/sd/autorun.sh ]
 then
        sleep 1
+       is_prevent_auto_start_wifi=yes
        chmod 777 /mnt/sd/autorun.sh
        /mnt/sd/autorun.sh

 fi

・自動wifi起動関連処理の続き

+if [ "$is_prevent_auto_start_wifi" = "no" ]; then
+       get_config -p "Auto Start Wifi"
+       autowifi=`cat /param_value.txt`
+       if [ "$autowifi" = "uap" ]; then
+               if [ ! -f /wifi_flag.txt ]; then
+                       uap
+
+                       # check and disable wifi after timeout if no station connects
+                       check_sta.sh &
+               fi
+       fi
+       if [ "$autowifi" = "sta" ]; then
+               if [ ! -f /wifi_flag.txt ]; then
+                       w2
+               fi
+       fi
+fi
+# set the default value if it is not set
+if [ "$original_auto_wifi_value" = "" ]; then
+       set_config -p "Auto Start Wifi" -v  "uap"
+
+fi

/etc/mtab における違い
・「none /dev/pts devpts mode=0622 0 0」が削除された
telnetdを消したことによる変更。

/etc/uaputl.conf における違い
・MaxStaNumの値が5から8に増加
同時接続数が増えた(「Max number of stations allowed to connect」)

/etc/uaputl_sender.conf というファイルが追加
「Trek_FLUCARD_WiFi」に関する設定が入っている。
かなり細かい設定が書かれている。

#   File : uaputl.conf


ap_config={
    SSID="Trek_FLUCARD_WiFi"         # SSID of Micro AP
    BeaconPeriod=100                # Beacon period in TU
    Channel=6                       # Radio Channel     6
#   Channel=0,1                     # auto channel select (MCS mode)
#   Channel=6,2                     # primary channel 6, secondary channel above.
#   Channel=6,4                     # primary channel 6, secondary channel below
    ChanList=1,6,11                 # Scan channel list
    #AP_MAC=00:21:E8:71:B8:F4        # MAC address of AP
    RxAntenna=0                     # 0 for Antenna A
                                    # 1 for Antenna B
    TxAntenna=0                     # 0 for Antenna A
                                    # 1 for Antenna B
    Rate=0x82,0x84,0x8b,0x96,0x0C,0x12,0x18,0x24,0x30,0x48,0x60,0x6c
                                    # Set of data rate that a station
                                    # in the BSS may use
                                    # (in unit of 500 kilobit/s)
    TxPowerLevel=13                 # Transmit power level in dBm
    BroadcastSSID=1                 # Broadcast SSID feature
                                    # 1: Enable  0:Disable
    RTSThreshold=2347               # RTS threshold value
    FragThreshold=2346              # Fragmentation threshold value
    DTIMPeriod=10                    # DTIM period in beacon periods
    RadioControl=1                  # 0: radio on  1: radio off
    MCBCdataRate=0                  # MCBC rate to use for packet transmission
                                    # 0:auto
                                    # >0 fix rate (in unit of 500 kilobit/s)
    TxDataRate=0                    # Data rate to use for packet transmission
                                    # 0:auto
                                    # >0 fix rate (in unit of 500 kilobit/s)
    PktFwdCtl=1                     # Packet forwarding control
                                    # 0: forward all packets to the host
                                    # 1: firmware handles intr-BSS packets
    StaAgeoutTimer=1800             # Inactive client station age out timer value
                                    # in units of 100ms
    PSStaAgeoutTimer=400            # Inactive client PS station age out timer value
                                    # in units of 100ms
                                                                        # try to set to 5 first for sender mode
    MaxStaNum=5                     # Max number of stations allowed to connect
    Retrylimit=7                    # Retry limit to use for packet transmissions
    AuthMode=0                      # 0:Open authentication
                                    # 1:shared key authentication
    Protocol=1                     # protocol to use
                                    # 1: No security    2: Static WEP
                                    # 8: WPA    32: WPA2    40:WPA2 Mixed Mode
    RSNReplayProtection=0           # RSN replay protection 0: disabled, 1: enabled
    PairwiseUpdateTimeout=100       #Pairwise Handshake update timeout: 100ms
    PairwiseHandshakeRetries=3      #Pairwise Handshake retries: 3
    GroupwiseUpdateTimeout=100      #Groupwise Handshake update timeout: 100ms
    GroupwiseHandshakeRetries=3           #Groupwise Handshake retries: 3

# **** WEP security setting******
#   KeyIndex=0                      # Index of WEP key to use (0 to 3)
#   Sample Key configurations are
#       Key_0=55555
#       Key_1=1234567890
#       Key_2="1234567890123"
#       Key_3=12345678901234567890123456

# **** Pairwise Cipher setting******
#    Configure both of the following for Protocol=40
#    PwkCipherWPA=4                 # Pairwise cipher type
                                    # 4: TKIP     8: AES CCMP
                                    # 12: AES CCMP + TKIP
#    PwkCipherWPA2=8                # Pairwise cipher type
                                    # 4: TKIP     8: AES CCMP
                                    # 12: AES CCMP + TKIP

# **** Group Cipher setting******

#    GwkCipher=4                    # group cipher type
                                    # 4: TKIP     8: AES CCMP

#    PSK="1234567890"               # WPA/WPA2 passphrase
#     GroupRekeyTime= 86400          # Group key re-key interval, in second.
                                    # 0 mean never re-key
                                    #802.11D specific configuration
    11d_enable=0                    # 0-disable 1-enable
#    country=SG                      # country information

}



ap_mac_filter={
    FilterMode=0                    # Mode of filter table
                                    # 0: filter table is disabled
                                    # 1: allow MAC address in the filter table to associate
                                    # 2: block MAC address in the filter table
    Count=0                         # Number of entries in filter table,up to 16
#Sample mac settings are
#    mac_1=00:50:23:45:76:22         # mac address
#    mac_2=00:34:22:77:46:34         # mac address
}

/etc/udhcpd.conf および /etc/udhcpd_uap.conf の変更点
default gatewayなどの設定に変化があり。

 start 192.168.1.50
 end   192.168.1.250  #default can hold max 200 FLUCARD
 max_leases      200
 interface       mlan0
 lease_file      /var/lib/misc/udhcpd.lease
 option  subnet  255.255.255.0
-option  router  192.168.1.1
+#option  router  192.168.1.1
 option  dns     192.168.1.1
-option  domain  FLUCARD
+#option  domain  FLUCARD
+option  search  192.168.1.1
 option  lease   86400 #1 day of seconds
 option  mtu     1500
 start 192.168.1.50
 end   192.168.1.250  #default can hold max 200 FLUCARD
 max_leases      200
 interface       uap0
 lease_file      /var/lib/misc/udhcpd.lease
 option  subnet  255.255.255.0
 option  domain  FLUCARD
 option  lease   10 #reduce lease time from 86400 to force pc renew ip
 option  mtu     1500
-option router 192.168.1.1
-option dns 192.168.1.1

・設定ファイル
/mnt/mtd/config/config.trek
/www/mtd/config/config.trek

いまの設定

[LANGUAGE]
English
[AP]
AP_ACCOUNT : 1
SSID : SSID名
Key : キー
[FTP]
FTP Path : アップロード先
User Name : ユーザ名
Password : パスワード
Server Type : Gallery3
Upload jpeg : yes
Upload raw : no
Upload video : no
[Wi-Fi Setting]
FLUCARD SSID : Trek_FLUCARD_WiFi
FLUCARD KEY :
Auto Start Wifi : none
My IP Addr : 192.168.1.1
Target IP Addr : 192.168.1.1
[MISC]
Download Enable :
Power Saving :
Channel : 6
Buzzer Mode : Normal
Display raw : yes
Sender jpeg : yes
Sender raw : no
Sender video : no
Public SSID : Trek_FLUCARD_Public
Private SSID :
Private KEY :
Always Private : no
Starting Mode : Public

・ファイルのアップロードログ
/www/page/upload.log

FLUCARD GEN 2とGEN 3の違い

firmwareアップデータのデータを確認すると、「FLUCARD GEN2」と「FLUCARD GEN3」というものが存在しているらしい。
「FLUCARD GEN1」は、黒いFLUCARDのことだと思われる。
「FLUCARD GEN3」が何をさすのかがよく分からない。16GBモデルのことなんだろうか?

それは、ひとまずおいておくとして、firmwareを見る限りでのFLUCARD GEN 2とFLUCARD GEN 3の違いを確認してみた。
busyboxバイナリ自体は同一の様に見える。
設定ファイルやWeb管理画面のテンプレートレベルでの差異は、以下の様になっていた。
GEN 3では、いろいろと音が鳴らないような感じになるのか?

diff -Nur initramfs/etc/udhcpd.conf initramfs3/etc/udhcpd.conf
--- initramfs/etc/udhcpd.conf   2012-04-05 13:25:02.000000000 +0900
+++ initramfs3/etc/udhcpd.conf  2012-04-09 16:06:48.000000000 +0900
@@ -7,6 +7,6 @@
 #option  router  192.168.1.1
 option  dns     192.168.1.1
 #option  domain  FLUCARD
-option         search  192.168.1.1
+#option        search  192.168.1.1
 option  lease   86400 #1 day of seconds
 option  mtu     1500
diff -Nur initramfs/usr/bin/rcS1 initramfs3/usr/bin/rcS1
--- initramfs/usr/bin/rcS1      2012-04-05 13:25:02.000000000 +0900
+++ initramfs3/usr/bin/rcS1     2012-04-09 16:06:48.000000000 +0900
@@ -1,3 +1,3 @@
-# alex remove telnetd
-# mount -t devpts /dev/pts
-# telnetd -l /bin/sh
+# alex comment out telnet  server
+#mount -t devpts /dev/pts
+#telnetd -l /bin/sh
diff -Nur initramfs/usr/bin/uap initramfs3/usr/bin/uap
--- initramfs/usr/bin/uap       2012-04-05 13:25:02.000000000 +0900
+++ initramfs3/usr/bin/uap      2012-04-09 16:06:48.000000000 +0900
@@ -1,4 +1,5 @@
 #!/bin/sh
+buzzer -t 2
 echo "uAp start"
 # load wifi driver
 w1
@@ -6,10 +7,10 @@
 sleep 2

 ifconfig mlan0 down
-# improve the scan time
+
+#improve the scan time
 iwpriv mlan0 scancfg 2 3 1 110  100 100

-buzzer -t 2

 sleep 2

@@ -96,12 +97,12 @@
 fi


-#sleep 1
+sleep 1


 uaputl sys_cfg_channel $channel

-#sleep 1
+sleep 1

 # generate unique ssid; by default is from config file; however, if there
 # is another flucard with the same ssid, automatically add suffix _1, _2, etc.
diff -Nur initramfs/usr/bin/uap_sender initramfs3/usr/bin/uap_sender
--- initramfs/usr/bin/uap_sender        2012-04-05 13:25:02.000000000 +0900
+++ initramfs3/usr/bin/uap_sender       2012-04-09 16:06:48.000000000 +0900
@@ -1,15 +1,14 @@
 #!/bin/sh
-
+buzzer -t 2
 echo "uAp for sender start"
 # load wifi driver
 w1

-sleep 2
+sleep 1

 ifconfig mlan0 down
-buzzer -t 2

-sleep 2
+#sleep 2



 #obtain the essid from config file
@@ -70,7 +69,7 @@
 # use separate config file from normal setting review
 uaputl sys_config /etc/uaputl_sender.conf

-sleep 1
+#sleep 1

 uaputl sys_cfg_11n 0
diff -Nur initramfs/usr/bin/w0 initramfs3/usr/bin/w0
--- initramfs/usr/bin/w0        2012-04-05 13:25:02.000000000 +0900
+++ initramfs3/usr/bin/w0       2012-04-09 16:06:48.000000000 +0900
@@ -1,3 +1,5 @@
+#!/bin/sh
+
 pkill httpd
 pkill dnsd
 pkill telnetd
@@ -8,3 +10,4 @@
 rmmod /lib/mlan.ko
 rmmod /lib/ka2000-sdio.ko

+
diff -Nur initramfs/usr/bin/w1 initramfs3/usr/bin/w1
--- initramfs/usr/bin/w1        2012-04-05 13:25:02.000000000 +0900
+++ initramfs3/usr/bin/w1       2012-04-09 16:06:48.000000000 +0900
@@ -1,8 +1,14 @@
+#!/bin/sh
 export FIRMWARE="/lib/firmware"
 insmod /lib/ka2000-sdio.ko
 insmod /lib/mlan.ko
 insmod /lib/sd8xxx.ko

+echo '' > /wifi_flag.txt
+
 #iwpriv mlan0 version
 #iwpriv mlan0 httxcfg 0x62
 #iwpriv mlan0 htcapinfo 0x1820000
+
+
+
diff -Nur initramfs/www/css/css_main.css initramfs3/www/css/css_main.css
--- initramfs/www/css/css_main.css      2012-04-05 13:25:01.000000000 +0900
+++ initramfs3/www/css/css_main.css     2012-04-09 16:06:46.000000000 +0900
@@ -29,7 +29,7 @@
 input.submit{  line-height: normal;    color: black;   font-size: 25px;        height: 18px;       width: 75px; font-weight: bold;}


-select  {vertical-align: middle; height: 50px; color: black;}
+select  {vertical-align: top;height: 10px      color: red;}
 select.list { width: 120px;}
 select.listL { width: 150px;}
 select.listS { width: 80px;}

Flucardのbuzzerコマンド

flucardは、まずスロットに入れた際、低い音で1回鳴り、おそらくOSが起動したタイミングで、ちょっと高い音で1回鳴ります。

また、autorun.shで実行時にbuzzerコマンドを呼び出し、音を鳴らしています。
autorun.shでは「buzzer -t 1」とか「buzzer -t 5」とかあるので、「-t」はtimeオプションで値は秒かな?と思っていました。

しかし、いろいろ実行してみた結果、以下のような感じでした。

-t 1 : てぃーらーろーれー(音が下がっていく
-t 2 : ちょっと高い音
-t 3 : てぃーれーろーらー(音が上がっていく
-t 4 : てぃーらーろーれー(-t 1よりちょっと高い音で、音が下がっていく
-t 5 : ブザーを止める
-t 6 : ぴー、ぴー(1個、音があがる)
-t 7 : ぴー、ぴー、ぴー(と短音リピート + コンソールに「WAITING_indicating」という出力
-t 8 : ぴー、ぴー、ぴー(と短音リピート
-t 9 : コンソールに「SHAKE_DETECT」という出力
-t 10以降は無い模様

「-t 5」で止めない限り、Flucardをスロットから外すまで鳴り続ける感じです。

使い方としては・・・

buzzer -t 3
sleep 2
buzzer -t 5

という感じで記述すると、音が上がっていく感じのブザーが2秒間鳴る、というところです。

Flucardでコマンドをいくつか実行してみた

とりあえずFlucardでコマンドをいくつか実行してみた。

firmwareアップデータに入っていたautorun.shを流用して以下の様なのを書いた。

#!/bin/sh
buzzer -t 2

df > /mnt/sd/df.txt
df -k > /mnt/sd/df-k.txt
mount > /mnt/sd/mount.txt
cat /proc/mounts > /mnt/sd/proc-mounts.txt
cat /proc/mount > /mnt/sd/proc-mount.txt
uname -a > /mnt/sd/uname-a.txt
cat /proc/cpuinfo > /mnt/sd/cpuinfo.txt
cat /proc/meminfo > /mnt/sd/meminfo.txt
ls -lR / > /mnt/sd/ls-lR.txt

sync
sleep 1

buzzer -t 1

sync
sleep 1

buzzer -t 5
mv /mnt/sd/autorun.sh /mnt/sd/autorun.sh.org

このファイルをFlucardに転送して、「しばらくおいておく」か、「1??_TREKフォルダ上の「設定・写真閲覧」の画像ファイルを消去する」か、「一度Flucardを抜いて、もう1度さす」と、autorun.shが実行される。

どうも定期的にautorun.shがないかを探しているんじゃないかなぁ、という感じがするが、まだそこら変をちゃんと調査していない。

で、autorun.shを実行した結果、後述の様なファイルを取得できた。

firmwareアップデート用のautorun.sh内では、/mnt/mtd/version.txtを更新し、しばらく待っているだけなように見えるが、これでなぜアップデートが完了するのか、という秘密を探さないとなぁ・・・というところ。

ちなみに、出荷時の/mnt/mtd/version.txtは以下の内容で、version3.txtは存在していなかった。

Product Name : FLUCARD GEN 2
Firmware Version : 3.24_100R
Build Date : 05 Aug 2011
Revision : 2
WiFi Model : Murata 11n

ちなみにアップデートすると、以下のようになる予定。

Product Name : FLUCARD GEN 2
Firmware Version : 3.65_100R
Build Date : 06 Mar 2012
Revision : 2
WiFi Model : Murata 11n

ちょっと気になるのはautorun.shの最後で「mv」でautorun.shの名前を変えているつもりなのに、されなかったところ。
アクセス権限関連でmvがちゃんと実行されていないような感じがする・・・

$ cat cpuinfo.txt
Processor	: ARM926EJ-S rev 5 (v5l)
BogoMIPS	: 200.29
Features	: swp half fastmult edsp java 
CPU implementer	: 0x41
CPU architecture: 5TEJ
CPU variant	: 0x0
CPU part	: 0x926
CPU revision	: 5

Hardware	: KeyASIC Ka2000 EVM
Revision	: 0000
Serial		: 0000000000000000
$
$ cat df.txt
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mtdblock0            1024       320       704  31% /mnt/mtd
/dev/mmcblk0p1         7774208      3392   7770816   0% /mnt/sd
$ cat mounts.txt
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
/dev/mtdblock0 /mnt/mtd jffs2 rw,relatime 0 0
/dev/mmcblk0p1 /mnt/sd vfat rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=winnt,errors=remount-ro 0 0
none /dev/pts devpts rw,relatime,mode=622 0 0
$
$ cat mount.txt
proc on /proc type proc (0)
sysfs on /sys type sysfs (0)
/dev/mtdblock0 on /mnt/mtd type jffs2 (0)
/dev/mmcblk0p1 on /mnt/sd type vfat (shortname=winnt)
none on /dev/pts type devpts (mode=0622)
$
$ cat meminfo.txt
MemTotal:          24856 kB
MemFree:           18256 kB
Buffers:             992 kB
Cached:             3620 kB
SwapCached:            0 kB
Active:             1720 kB
Inactive:           3136 kB
Active(anon):        244 kB
Inactive(anon):        0 kB
Active(file):       1476 kB
Inactive(file):     3136 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                32 kB
Writeback:             0 kB
AnonPages:           284 kB
Mapped:              440 kB
Shmem:                 0 kB
Slab:               1004 kB
SReclaimable:        364 kB
SUnreclaim:          640 kB
KernelStack:         200 kB
PageTables:           52 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       12428 kB
Committed_AS:       2932 kB
VmallocTotal:     833536 kB
VmallocUsed:         316 kB
VmallocChunk:     833188 kB
$

ls-lR.txtを貼ってみたら、長すぎたようで、ちゃんと表示してくれなかったので、省略・・・

Amazon Trek2000ストア
楽天 Trek2000ストア
送料無料! Wifi機能付きSDカード ...

送料無料! Wifi機能付きSDカード …
価格:4,700円(税込、送料込)

送料無料! Wifi機能付きSDカード Flucard16GB

送料無料! Wifi機能付きSDカード Flucard16GB
価格:9,890円(税込、送料込)

Flucard Proが届いた

とりあえず、CANON IXY DIGITAL 110ISに入れて、Galaxy Nexusから接続してみたところ、特に問題なくつながっている感じです。

無線機能を有効にした場合に、ビープ音が10回なるのがうるさいですね。
ここらへんは改造できそうなので、あとでやるとしましょう・・・

標準状態のSSID: Trek_FLUCARD_WiFi
ファームウェア
製品名: FLUCARD GEN2
ファームウェアバージョン: 3.24_100R
作成日付: 05 Aug 2011
レビジョン: 2

おそらく現行出荷版は全部このバージョンじゃないのかなぁ、と思われる。

最新版firmware内には、「FLUCARD GEN2」向けfirmwareと、「FLUCARD GEN3」向けfirmwareが入っていた。
GEN3は、16GBモデルのことを指しているんだろうか?
それとも、8GBモデルも2種類あるんだろうか?

で・・・firmwareを改造しようと思ったら、1点重大な点を発見・・・

フルサイズのSDHCカードを読める道具がない・・・
SDカードを読めるやつはあるけれど、それ以外は全部microSDHC用だった・・・
うっかりしてましたねぇ
どっかで入手してこないと改造ができない^^;;;