東芝から発売されているFlashAirを用いた開発を行う人々向けのまとめwikiです。※本wikiは東芝及びフィックスターズ、キオクシアとは何の関係もありません。お問合わせは管理者へお願いします。

FlashAirへのTelnetアクセス

海外の掲示板の情報から,FlashAirにTelnetアクセスできることがわかりました.
Luaのデバッグ作業にかなり有益な効果をもたらすと考えられます.

Topic: Using the Toshiba FlashAir card for ML development (Read 5783 times)
https://www.magiclantern.fm/forum/index.php?topic=...

ただし,場合によっては不安定になり,フリーズする場合もあるようです
非公式な手段のため,注意して使用してください

アクセス方法

CONFIGに以下の記述を追加します
TELENT=1

その後,TeraTermなどで,23番ポートへTelnetアクセスすると,
以下のようにWelcomeメッセージが表示されます
 Welcome to FlashAir
 ESC R4539 built 15:37:44, Aug 28 2015
 >

Luaが動くんだよ

Welcome to FlashAir
ESC R4539 built 15:37:44, Aug 28 2015
> lua
lua
Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio

> lua -h
lua -h
lua: unrecognized option '-h'
usage: lua [options] [script [args]]
Available options are:
  -e stat  execute string 'stat'
  -i       enter interactive mode after executing 'script'
  -l name  require library 'name'
  -v       show version information
  -E       ignore environment variables
  --       stop handling options
  -        stop handling options and execute stdin
> lua -e "print("Hello World")"
lua -e "print("Hello World")"
Hello World
> lua -e "print("Number="..(200+100))"
lua -e "print("Number="..(200+100))"
Number=300
>

ブラウザで走らせるLuaを,コマンドから実行することもできます.
また,この時のprintによる出力は,ちゃんと標準出力ですし,エラーも出力されます.
> lua /FTLE/run.lua
lua /FTLE/run.lua
HTTP/1.1 200 OK

Hello World
>

なんと,fa.requestで長い時間がかかるときは,*で時間かかってることを示してくれる親切機能も.
さらに詳細エラー情報もでる様子.
> lua -e "print(fa.request("http://192.168.0.2/"))"
lua -e "print(fa.request("http://192.168.0.2/"))"
*********************************************************************************************************************************
 dp_send_data_frame(): ERROR : sta_info 00:00:00:00:00:00
status err
Error argument:8286fff2
        -1      nil
>

eva.cgiとの違い

eva.cgiと違い
  • 起動時のログらしきものは取得できません

ブラウザ側のLuaで吐いたエラーなどは,コマンドの空打ちで,バッファにたまったものが取得できるようです.
自然には出力されません.
> x
lua /FTLE/run.lua

lua: /FTLE/run.lua
:8: THIS IS FTLE SIDE ERROR TEST
stack traceback:
        [C]: in function 'error'
        /FTLE/run.lua
:8: in main chunk
        [C]: in ?
> x
unknown command
>

できること

helpコマンドの実行結果を以下に示します.
末端が切れているため,実際にはできることはもっと多いと思われます.
 Welcome to FlashAir
 ESC R4539 built 15:37:44, Aug 28 2015
 > help
 help
 help          show help
 version       show version
 mod           Modify Memory
 fdump         Memory dump to file
 dump          Dump Memory
 stat          show status
 ip            Address Setting
 ping          ping
 reboot        reboot system
 macsend       MAC frame send
 setup         TELEC command
 send          TELEC command
 stop          TELEC command
 show          TELEC command
 deauth        deauth command
 print         console output
 srom          SPI ROM access
 sleep         sleep setting
 fat           file system
 wlan          Wireless LAN control
 dhcpd         DHCP server
 dhcpc         DHCP client
 nbios         NetBios service
 wps           Wi-Fi Protected Setup
 sd            SD Card Access
 http          HTTP Client
 httpd         HTTP Daemon
 tz            HTTP Daemon Time Zone [-48..56]
 rfic          set RF-IC serial data  rfic <data(0xX...)>
 sysclk        change System clk
 ps            ps [on/off]
 pw            pw <bboff/bbon/anaoff/anaon/rfoff/rfo

この出力は,以前から確認されていた,FlashAir起動時実行のコマンドにhelpを指定した
COMMAND=help
の出力時のeva.cgiの結果と同様と考えられます.

参考に,eva.cgiの出力結果を以下に示します.
TELNET=1を指定していないとき
> f_SCAN CH=1
SCAN CH=2
SCAN CH=3
SCAN CH=4
SCAN CH=5
SCAN CH=6
SCAN CH=7
SCAN CH=8
SCAN CH=9
SCAN CH=10
SCAN CH=11


[SEC] (info) Authenticator Mode
[SEC] (warning) PSK passphrase length is too short

[SEC] (info) InitializeSecTask
set ap.group_cipher


[SEC] (info) Group Cipher = CCMP

[SEC] (info) check SSID and its length ... OK
DHCP server task start
[NB] Registered successful (FLASHAIR)


[SEC] (info) association succeeded (RSN STA : 0:22:cf:f0:63:a4)

[SEC] (info) sending 4-Way Handshake Message 1

[SEC] (info) received 4-Way Handshake Message 2

[SEC] (info) sending 4-Way Handshake Message 3

[SEC] (info) received 4-Way Handshake Message 4

[SEC] (info) Pairwise Cipher (0:22:cf:f0:63:a4) = CCMP

[SEC] (info) rsn_auth  Handshake has been completed

COMMAND=helpを指定しているとき
> help
help          show help
version       show version
mod           Modify Memory
fdump         Memory dump to file
dump          Dump Memory
stat          show status
ip            Address Setting
ping          ping
reboot        reboot system
macsend       MAC frame send
setup         TELEC command
send          TELEC command
stop          TELEC command
show          TELEC command
deauth        deauth command
print         console output
srom          SPI ROM access
sleep         sleep setting
fat           file system
wlan          Wireless LAN control
dhcpd         DHCP server
dhcpc         DHCP client
nbios         NetBios service
wps           Wi-Fi Protected Setup
sd            SD Card Access
http          HTTP Client
httpd         HTTP Daemon
tz            HTTP Daemon Time Zone [-48..56]
rfic          set RF-IC serial data  rfic <data(0xX...)>
sysclk        change System clk
ps            ps [on/off]
pw            pw <bboff/bbon/anao

テストした機能

exit

切断

Lua

> lua -e "for i=0,10 do print("Hello World") end"
lua -e "for i=0,10 do print("Hello World") end"
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World

base64

> base64 "Hello World"
base64 "Hello World"
ren=16
SGVsbG8gV29ybGQ=

fat ls

1回では出し切れない時がある模様
> fat ls /
Number of file(s):3
DIR DCIM                         0 2017/07/02 18:01:16
DIR SD_WLAN                      0 2016/07/04 17:11:34
DIR System Volume Information         0 2017/07/02 18:01:22
DIR FTLE                         0 2017/05/11 16:31:58
FIL favicon.ico               7358 2015/12/13 18:06:52
FIL FlashTools.lua            2579 2017/05/15 18:27:08
fat ls 1:
FIL geolog.lua                 809 2017/07/04 20:06:02
> fat ls 1:
Number of file(s):22
FIL FA000001.JPG            128617 2016/07/04 17:11:34
FIL auto.png                 68180 2016/07/04 17:11:34
FIL BCONFIG                    181 2016/07/04 17:11:34
FIL Set.htm                  26371 2016/12/01 17:13:20
FIL backup.htm               21699 2016/07/04 17:11:34
FIL bg.png                  998602 2016/07/04 17:11:34
FIL dcim.png                 23901 2016/07/04 17:11:34
FIL folder.png                6956 2016/07/04 17:11:34
FIL general.js              100312 2016/11/28 15:30:06
FIL lang.js                 127656 2016/10/24 11:41:12
FIL manual.png              154080 2016/07/04 17:11:34
FIL movie.png                12021 2016/07/04 17:11:34
FIL other.png                 9595 2016/07/04 17:11:34
FIL photo.png                 9775 2016/07/04 17:11:34
FIL song.png                  9962 2016/07/04 17:11:34
a
FIL stpicpth.htm             12024 2016/07/04 17:11:34
FIL text.png                  7270 2016/07/04 17:11:34
FIL welcome.htm               4495 2016/07/04 17:11:34
FIL 1xsize_parts.png         43636 2016/07/04 17:11:34
FIL 2xsize_parts.png        106352 2016/07/04 17:11:34
FIL 00files.txt                 17 2016/07/04 17:11:34
FIL fwupdate.fbn           1488540 1980/00/00 00:00:00
> a
unknown command
>

level

> level 2
level 2
 factory
> help
help
help          show help
version       show version
mod           Modify Memory
dump          Dump Memory
stat          show status
ip            Address Setting
ping          ping
reboot        reboot system
print         console output
fat           file system
wlan          Wireless LAN control
sd            SD Card Access
factory       Read/Write Factory Information (0xD0000)
current       factorycurrent
userpg        start user program
wsd           wsd <port>
lua           LUA
update        fwupdate
websocket     WebSocket Client (TWSC)
i2c           i2c test
> level 1
level 1
 enduser
> help
help
help          show help
version       show version
mod           Modify Memory
dump          Dump Memory
ip            Address Setting
ping          ping
fat           file system
wlan          Wireless LAN control
sd            SD Card Access
userpg        start user program
wsd           wsd <port>
lua           LUA
update        fwupdate
websocket     WebSocket Client (TWSC)
i2c           i2c test
>

> level 1048
level 1048
 developer
> help
help
help          show help
version       show version
mod           Modify Memory
fdump         Memory dump to file
dump          Dump Memory
stat          show status
ip            Address Setting
ping          ping
reboot        reboot system
setup         TELEC command
send          TELEC command
stop          TELEC command
show          TELEC command
deauth        deauth command
print         console output
sleep         sleep setting
fat           file system
wlan          Wireless LAN control
dhcpd         DHCP server
dhcpc         DHCP client
nbios         NetBios service
wps           Wi-Fi Protected Setup
sd            SD Card Access
http          HTTP Client
httpd         HTTP Daemon
tz            HTTP Daemon Time Zone [-48..56]
rfic          set RF-IC serial data  rfic <data(0xX...)>
iperf         Measuring performance
sysclk        change System clk
ps            ps [on/off]
pw            pw <bboff/bbon/anaoff/anaon/rfoff/rfon>
pio           pio

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Menu

スマートフォンの方は画面下部よりPC版に切り替えることをおすすめします

アクセス解析中

忍者アナライズ

GoogleAnalytics

編集にはIDが必要です