Buffalo Soldiers

lbenson

Senior Member
>NAS running Perl and PL2303 drivers

Not to hijack this thread, but if you want to pursue it, I'd ask a few questions.

What's the NAS?

What's it running (if a form of *nix, try 'uname -a')?

Are the drivers for PL2303 for usb and are all the usb drivers available (try "lsmod")?

When you plug in the usb-serial, do you get a device (try 'ls /dev/ttyUSB*')?

If not, when you plug it in after booting and type 'dmesg | tail -n 20' what do you get (the last 20 lines of the console log)?

Do you have a terminal available on the device like picoterm or miniterm on which you could set baud rates and run a loopback (tie pin 2&3) to see if what you type is echoed?

If you have a serial device, e.g., ttyUSB0, with your new scope do you see anything on tx if you do 'echo UUUUUUUU >/dev/ttyUSB0'? Can you figure out what the baud rate is?

More if you're interested.
 
Last edited:

hippy

Ex-Staff (retired)
Buffalo LinkStation Live ( HS-DS320GL ). For uname -a ...

Linux NAS 2.6.12.6-arm1 #81 Wed Mar 7 11:17:24 JST 2007 armv5tejl unknown

/dev/ttyUSB0 works okay, can login via serial port having set getty. Perl is version 5.8.8
 

steliosm

Senior Member
Do you have opkg installed?
What is the output of "opkg update" command?
Switching to Lua would also help me with my pet project. Would you consider spending a few Kbytes to install Lua on this machine?
 

hippy

Ex-Staff (retired)
Not sure if opkg is installed but I'll check. It's currently on a separate local network spur with no access to the internet but I should be able to reconfigure that. I would ultimately like to get Perl talking serial ( and FTDI drivers working ) but any port in a storm ! Perhaps by the time I'm done I'll understand how to :)

One of the advantages of a NAS is infinitely writeable, huge disk ( not sure how it's partitioned though ) plus drag and drop from a PC so shouldn't be a problem installing lua and setting things up and I'm willing to give it a try. Have already installed the Windows latest version. With a quick mod to lbenson's code I've got it sending via a serial port, so that's great news ( and another language to add to the CV ). Must say I'm impressed that it uses a MIT License which I wholeheartedly approve of. It's a lot more advanced and well put together than it was when I last looked a few years ago.

If it goes well you may have convinced me to purchase a BifferBoard and get on-board. Still considering the Open Mesh option as well. One I've had my eye on if I ever could do it ...

http://www.omnima.co.uk/store/catalog/Embedded-controller-p-16140.html
 

steliosm

Senior Member
Well, if you got the opkg install then you can have Lua installed in a couple of seconds - "opkg install lua". If you don't have Internet access from the NAS device, you can download the ipk file, copy it over to NAS and install it pretty much the same way. You will need, though, to find out the version of the OpenWRT that it's installed. The /etc/opkg.conf should give you some tips, such as the repository location.

I never actually used Perl to do any serial communications. Now that I'm thinking of, it's been years since I last used Perl to do anything. I take it your NAS runs a modified version of perl (maybe micro-perl) in order to fit on the flash chip.

I have the omnima controller and I played a bit with it. Smaller flash chip and memory chip, faster than the bifferboard though. It's sort of unsupported device on the software part. The guy who was making an OS for this board and also linux kernel patches stopped making them at some point. He started working on bifferboard and also selling them :) I wouldn't invest my time and my money on this board.

If your kernel supports it, (it should, it's 2.6) you could try creating an alias device for your interface. The command is ifconfig eth0:0 <other_IP> netmask <other_netmask>. Make sure to add a default route through that interface, if that's the one that you will use to connect to the internet. As usual, playing with IPs addresses is better to do when you have physical access to the machine - console and keyboard or a serial connection.

The OpenMesh router platform looks fine but I would prefer something that it's dead easy to install and configure. The way I use the bifferboard, also in another project, doesn't need any configuration, everything happens magically. Even the software updates are automatically - just reboot the module to get the latest versions! The main issue with the WiFi routers is that you need to somehow configure the ESSID, WPA, etc parameters to the router before starting using it as a network gateway for your project.

I hope you can get Lua on your NAS device. This way you can help with the software testing without needing to buy a bifferboard.
 
Last edited:

hippy

Ex-Staff (retired)
Not found opkg yet but found instructions for ipkg install. It's not running OpenWrt but seems to be similar to NSLU2. No flash either, just a 320GB disk so all OS boots from that. Tried the ifconfig tricks previously but it seems this does something clever which overrides those changes. Will have to look in detail later.
 

lbenson

Senior Member
Regarding Infineon ADM5120, 2mb flash won't, so far as I know, run standard openWrt firmware--4mb is minimum. DDwrt can go on 2mb, but I don't know it. I don't know what openWrt Squidge is--perhaps a fork for smaller devices.

ipkg seems to imply that it might use optware packages (see http://www.nslu2-linux.org/wiki/Optware/Packages). Many packages similar to those of openwrt would be available, but would depend upon the cpu used (and OS). What response do you get to 'cat /proc/cpuinfo'? Lua 5.1.4-2 is available for many CPUs, if the device is compatible with optware packages.

There might be more info on the Buffal nas-central site: http://forum.buffalo.nas-central.org/viewforum.php?f=41

Most of my knowledge, such as it is, is about openWrt or debian.
 

steliosm

Senior Member
The idea behind the omnima controller is to have the kernel on the flash and the rest of the OS on a USB flash/disk. The device boots the kernel and the kernel mounts the USB as the filesystem.
 

hippy

Ex-Staff (retired)
Seems that ipkg was my main stumbling block. Have now got that installed, lua as well, and talking via a USB010 (PL2303) to a PC ( first time, subsequently it doesn't send anything but does toggle the control lines ). Doesn't seem to be any perl-serial packages so guess lua will have to do.
 

steliosm

Senior Member
Great!
One more thing, you need to have stty installed as well in order to configure the serial port. Now, you only need to download the OpenBridge software and start playing with it!
Here is the download link: openbridge

Edit the config.ini file to set devices and speed. Run the memcached fie first (lua memcached &) and then the openbridge (lua openbridge.lua).

The commands supported for now are:
  • Set a register value: SET|<var_name>|<var_value>
  • Get a register value: GET|<var_name>
  • Make an HTTP request: HTTPGET|<url>
  • Send a twitter update: SENDTWEET|<username>|<password>|<tweet>
  • Send a pachube update (cvs): PACHUBE|<api_key>|<feed .csv>|<data>

Post commends, bugs in the OpenBridge thread. Enjoy :)
 

hippy

Ex-Staff (retired)
Code:
root@NAS:/mnt/disk1/share/openbridge# lua Memcached.lua

lua: Memcached.lua:23: module 'socket' not found:
        no field package.preload['socket']
        no file './socket.lua'
        no file '/opt/share/lua/5.1/socket.lua'
        no file '/opt/share/lua/5.1/socket/init.lua'
        no file '/opt/lib/lua/5.1/socket.lua'
        no file '/opt/lib/lua/5.1/socket/init.lua'
        no file './socket.so'
        no file '/opt/lib/lua/5.1/socket.so'
        no file '/opt/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        Memcached.lua:23: in main chunk
        [C]: ?

root@NAS:/mnt/disk1/share/openbridge# ls -l

-rwxrw-rw-    1 nobody   nogroup      5748 Dec  8  2008 CRC32.lua
-rwxrw-rw-    1 nobody   nogroup     14434 Apr 17 13:35 Memcached.lua
-rwxrw-rw-    1 nobody   nogroup       148 Aug  2 19:08 config.ini
-rwxrw-rw-    1 nobody   nogroup     15084 Aug  2 19:05 memcached
-rwxrw-rw-    1 nobody   nogroup      6247 Aug  4 10:59 openbridge.lua

root@NAS:/mnt/disk1/share/openbridge#
Both /opt/share/lua/5.1 and /opt/lib/lua/5.1 are empty. Installed using ipkg install lua as root

Added : Just realised should be running lua memcached & not lua Memcached.lua but same result, missing socket
 
Last edited:

lbenson

Senior Member
>Tried ipkg update and ipkg install luasockets but getting 'no such package'

Ok, so it looks like you are using NSLU2 optware, so your NAS is an arm device. Luasockets is not listed on the repository site, so appears not to be available in your default package feed.

It is available here: http://ipkg.nslu2-linux.org/feeds/openwrt/unstable/ixp4xx/packages/

You can add that to your ipkg repository feeds list. I'm not sure where that is located or what it is called, but you can probably find it with 'find / -name ipkg*'. Even if that doesn't give a clear name for a list, it will probably show a config file of some sort, and reading that will probably say what the feed list is called. It's just a text file which can be edited with vi, and the repository can be added. You've indicated you have lots of disk space. You might want to install a better editor than vi, if you haven't already--try 'ipkg install nano'.

Installing luasocket (no 's') might give you a version error since it's from a different feed, but it also might well work.
 
Last edited:

steliosm

Senior Member
The ipk package is a gzip tar package. You can download it from the repository, extract the contents (should be control and data archives) and just copy the lua sockets directory and file over to /usr/lib/lua. No need to use the opkg system for this.
 

hippy

Ex-Staff (retired)
No luck with adding the luasockets even after adding the alternative feed, nor can I get it to work downloading and trying to open the .ipk renamed as .gz or .tar.gz - Invalid archive. Other packages are downloading so it seems not to be a configuration issue.
 

steliosm

Senior Member
Hippy, try checking the file with the 'file' command.
This should give us some hints about the file type.

Code:
$ file luasocket_2.0.2-3_rdc.ipk 
luasocket_2.0.2-3_rdc.ipk: gzip compressed data, from Unix, last modified: Sun Mar 28 21:38:49 2010
 

hippy

Ex-Staff (retired)
I doubt that will work as the two core.so files will be MIPS binaries and I need ARM binaries.

This where my caveat of it being great "if it just works" comes from; but opefully not a problem for OpenBridge if you are targetting BifferBoard and providing everything on a plate, likewise for lbenson with Asus WL-520gU and Andrew with OpenMesh. Step away from such specific configurations and problems and brick walls can spring up.
 

steliosm

Senior Member
I thought your device was NSLU2 compatible. My mistake, it wont work.
The only thing that I see will work is to actually download the OpenWRT and compile the package by hand.
@lbenson have you had a change to try out the openbridge yet?
 

lbenson

Senior Member
>Step away from such specific configurations and problems and brick walls can spring up.

This is where the traditional linux/unix approach of "compile everything yourself" comes into play I'm not really attuned to this approach myself, and it isn't easy on a small device, where you're likely to need a cross-compiler and "tool chain" on a different, bigger machine, and considerations come into play of which C libraries were used in compiling your device's OS.

That said, if people could compile natively on an NSLU2 with thumb drive, you could probably do it on your NAS with 320gb hd.

But while you may need luasocket to run the code from Stelios, you don't need it to communicate with a picaxe, and to do things like send emails, send sms messages via a cell phone, modify web pages, and control a picaxe using commands over the web. My rivercam thread shows html and cgi code for using radio-button clicks to control a picaxe over serial (this is input to the picaxe only).
 

lbenson

Senior Member
Stelios--I just downloaded it (note that the code link is not present in your original "openbridge" thread). It looks well-structured, and certainly useful. I'm not sure when I'll get to have a play--lots on the plate right now. This is exactly what I have an interest in, tho.
 

steliosm

Senior Member
I will upadate the original thread with a link to the project's web page, so people can have some documentation to start playing with it.
 

lbenson

Senior Member
hippy--I just noticed that the luasockets file which you were unable to download was a nslu2-linux hosting of an openwrt file, so you may be able to use the arm version here direct from openwrt:

http://downloads.openwrt.org/snapshots/trunk/ixp4xx/packages/luasocket_2.0.2-3_ixp4xx.ipk

This probably won't be enough. I also had to download a liblua file. The exact one is not in the openwrt directory, but you might get what is needed from:

http://downloads.openwrt.org/snapshots/trunk/ixp4xx/packages/liblua_5.1.4-6_ixp4xx.ipk

You can add the url to the ipkg list (without the filename), and use ipkg to install. There still might be version differences, since this is the latest snapshot, but all might work ok.
 
Top