Sunday, July 15, 2012

Computing can be puzzling.

Time to work a little bit on Robopet. Had two goals. First was to get the spare Palm to connect to the serial port and second to install the lightweight Boa web server. Thought that this would all go quite quickly and then off to hit the sack. But Noooooo....

Had everything up an running on Robopet. Tried to ssh into Robopet and no go. Logged into Robopet directly and found that the Ethernet port was not up and running.

$ ifconfig
lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Need to look at the network settings.

$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# eth0
 auto eth0
 iface eth0 inet dhcp

# wlan0
# wireless is disabled for now.
#auto wlan0
#iface wlan0 inet dhcp
#wireless-essid robotworld
#wireless-mode managed
#wireless-ap 00:00:00:00:00:00
# wireless-ap any
#wireless-channel 11

Ugh.. So I decided to shut the system down. and check to make sure the nic (network interface card) was properly seated.

$ sudo poweroff

Checked out ok. So I restarted Robopet. Powered up for a few seconds and died. Tried re-powering Robopet and it would not even come up. The power supply was promptly replaced.  Rebooted the machine and so far so good.  Back to testing the ethernet port. No go. Then I noticed that I had put the nic in a pci slot that I had noticed was bad. (Got the motherboard with a whole bunch of other parts for dirt cheap, so you can not expect the stuff to be perfect). Shut the system down again and moved the nic pci card to a slot that was good. Re-powered  the unit. Checked for the card working.

$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00 
          inet addr:192.168.1.54  Bcast:192.168.1.255  Mask:255.255.255.0
          Scope:Link UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1550 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:531663 (519.2 KiB)  TX bytes:231313 (225.8 KiB)
          Interrupt:10 Base address:0xff00

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Eth0 was working.  Time to log into Robopet again.

$ ssh robopet

Robotpet would not take my password. So I tried using the ipaddress

$ ssh 192.168.1.54

All was well.  Now to get the Pda working with the unit. The Palm pda will not work as is as a dumb terminal, so I had to install a program on to it from another computer called ptelnet.prc using a usb to serial interface. The Palm has an interface cable that will plug directly into the 9 pin serial port on the back of the computer.

$  pilot-xfer -p /dev/ttyUSB0 -i ptelnet.prc

That should be easy. First to test the port. Strange the serial port on what is commonly known as com2:. (com1: =ttyS0)

$ sudo /sbin/getty -h -L /dev/ttyS1 9600 vt100 &
$ sudo chmod 666 /dev/ttyS1

A prompt did not show up on the Palm pda. Now what is the problem? Time to log out and restart the computer to go into the bios. Went into the bios and noticed there were two serial ports, but you could only have one port working at a time. The motherboard was set for the second port which was IR only. Changed the motherboard to use port 1 and disabled IR. Saved the settings and rebooted. Used the temp command again to test the serial port.
 
$ sudo /sbin/getty -h -L /dev/ttyS0 9600 vt100 &
$ sudo chmod 666 /dev/ttyS0
 
The login prompt came right up on the Palm pda. Logged in and all was well. Beginning to feel like Sherlock Holmes solving issues.  Sshed back into Robotpet. Now I had to make the port available all the time.

$ sudo vim /etc/inittab

Needed to uncomment on line to make that so. (i.e. remove the pound sign)

Changed:
# T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
to
T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100



Rebooted Robopet. And the login prompt came right up on the Palm pda. So far so good. Now for the second part of the project.

Apache is a fine web server, but I wanted something real light that supported what is known as CGI (Common Gateway Interface) which meant I could easily program the web interface with batch or shell files.  Boa had been around for years and would fit the bill.

$ sudo apt-cache search boa
$

No Boa. So I went to the web to get the source code. Downloaded the .94 version as boa.tar.gz. This was a compressed file sort of like a zip file.Time to uncompress it.

$ tar zxvf boa.tar.gz

Changed into the boa directory and read the docs. for installation.

$ sudo ./configure;make

Yeah, I would be in business soon. Waited for a while for it to supposedly compile. When it finished there was no binary or program to run. Searched through the docs and no information to glean. Frustrated. Went to launchpad.net to get a specific binary. There was a new compressed file. There was a comment saying there was no binary. Downloaded the new file. Uncompressed it and  ran through the compile sequence.  Still no binary.  Super frustrated at this point.  So much for the easy part I thought would happen.  Looked around launchpad a bit for a clue. Lo and behold there was a binary.  I downloaded the file and then installed it.

$ wget http://launchpadlibrarian.net/1378971/boa_0.94.14rc20-1.2_i386.deb
$ sudo dpkg -i boa_0.94.14rc20-1.2_i386.deb

I went to the web browser on another machine and typed in the url of Robopet and viola there was a web page (albeit just a directory listing).

Index of /

Files


Index generated Sun Jul 15 15:29:52 2012 UTC

That means it worked!!!!!  Now I can use the Chumby wirelessly to access Robopet and control it. Now to get some web pages done.  Hopefully I have introduced you to some linux/unix commands that may be of use to you in the future.  Later.....

No comments:

Post a Comment