I am trying to download LUA file to the Fastrack Modem after install ftp server,PuTTY in my PC and load Lua interactive shell to the modem.
After type in the shell: “$ l ‘web.lua’” - I receive the following Error:
Lua interactive shell
$ l ‘web.lua’
run(): error: Can’t connect to FTP
stack traceback:
[C]: in function ‘ftp_client’
?: in function ‘ftp_client’
?: in function <?:58>
Done. Lua VM uses 61552 bytes.
$
Who can I fix it please advice???
another think I try to use the AT command ‘AT+LUA’ in the terminal and I receive ERROR Way?
please advice how can fix this problems and start to write in LUA
I have Fastrack Supreme 10
And i Succed load LUA and run it
try some of the command like print,wip.tcp_client that are working
but i can not load file to it
please advice
@awneil: If he gets a telnet shell, then it is compatible
@zamirdor: the FTP connection that’s in charge of downloading source code failed, without producing an FTP protocol error. The most likely reasons are:
either you don’t have full IP enabled, hence no FTP client (last time I checked it was a feature you had to pay for, if in doubt, check with your distributor or FAE);
or your FTP server on the PC isn’t set up properly (it must accept anonymous login).
Your FTP server must be able to produce connection logs. If you can’t find any, it probably means you don’t have full IP enabled. It is technically possible to replace the WIP FTP client with an implementation in Lua (there’s a sample in the wiki), but that’s not completely trivial and I can’t help you doing that. If you get traces of a connection attempt to your server (or even ethereal traces), please provide them.
The following command will cause a low level FTP connection and print every message sent by WIP FTP:
$ x=internal.ftp_client(‘192.168.1.5’, ‘anonymous’, 'iewjdie@deij.com’, 21, true); x:hook(’*’, function(…) print(…); return ‘again’; end)
run(): error: shell:1: Can’t connect to FTP
stack traceback:
[C]: in function ‘ftp_client’
shell:1: in function ‘?’
?: in function <?:76>
If I understand right there is possible that I have some missing function in my modem like ftp client.
It possible to add the lib. or I need to buy it.
And if there any other way to download Lua file to the modem.
I try to connect to my FTP server from my PC local and I succeed to connect to the ftp and to see all files in root dir.
I try to connect from the modem with this command:
from C, with luaW_run( source_code_or_bytecode) (cf. appli.c in the default sample for details)
As soon as you’ve got sources on the module, you can compile them with the standard lua loadstring() function (which takes a source string and returns an executable function). FTP is by far the easiest and fastest way to get your code on the module, and I strongly recommend that you purchase at least one licence, for your development kit (you don’t necessarily need it on field). It will be more than worth the development time you’ll save.
Now, if for some reason you can’t get FTP, here’s a quick&dirty hack that will let you upload and run files on the module. Let’s write, on the module’s shell, a program that listens on TCP port 2037, reads whatever is sent on it, compiles it as source file and runs the resulting bytecode:
Lua interactive shell
$ function read_and_run_src(s)
+ local src=s:read '*a' -- read whole file
+ printf("read %i bytes of source", #src)
+ local f, msg = loadstring(src) -- compile it
+ if f then return f() else error(msg) end -- run it on success
+ end
$ src_server = wip.tcp_server(2037, read_and_run_src) -- use above function as callback for TCP server
$ _
Now, from your PC, send files to port 2037 and they’ll be compiled and run (here I use netcat to send stuff on TCP sockets):
You can also rebuild your own FTP-based solution, taking inspiration from wavecom.com/lua/wiki/tiki-in … eFtpClient, but although I don’t know how expensive full IP licences are, I’m pretty sure it won’t be worth the time spent.
If I will not buy this lib. could I connect to GPRS and send data?
Because I have some problems to connect to GPRS bearers.
I config all option like PIN=1234 APN=internetg login="" password=""
and after start wip.bearer_client(‘GPRS’, gprs_config)
it respond “setting PIN code” and stack.
is it because I don’t have the lib or I do some think wrong
Full IP is a feature to enable in the module’s EEPROM, ask your distributor for details. AT+LUA is only available when the Lua sample is loaded. If you don’t have a telnet running, you can try e.g. this:
at+lua="print'Hello world'"
OK
[LUAW] Hello world
(you might get additional traces about RUN and SIGNAL if you compiled with WIP debug traces enabled, which is the default setting).
Sending Lua commands through AT+LUA is by no way user-friendly, it’s mainly intended as an emergency recovery feature, if for some reason you can’t get a telnet to work.