index
Slug Menu

Openwrt NSLU2 (Slug) with HD webcam
- some random notes for my own backup

In order to automatically start the init script on boot, it must be installed into /etc/rc.d/
Invoke the "enable" command to run the initscript on boot:
# /etc/init.d/example enable


Openwrt toolchain notes

to compile C code -

8.09
/home/graham/openwrt/openwrt809/8.09/staging_dir/toolchain-armeb_gcc4.1.2/bin/armeb-linux-gcc

development
/home/graham/openwrt/development/trunk/staging_dir/toolchain-armeb_v5te_gcc-4.3.3+cs_uClibc-0.9.31_eabi/bin/armeb-openwrt-linux-uclibcgnueabi-gcc -o hello hello.c

Backfire failed with
Collected errors:
* satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-video-core:
* satisfy_dependencies_for: kmod-i2c-core *
* opkg_install_cmd: Cannot install package kmod-video-core.


for MJPG-Streamer etc
opkg install kmod-usb-uhci kmod-scsi-core kmod-usb-storage kmod-fs-ext2 kmod-fs-ext3 kmod-fs-vfat

in /etc/done
/sbin/mjpg_streamer -i "input_uvc.so -r 960x720" -o "output_http.so -p 8080 -w /webcam_www"


root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 1.4M 1.4M 0 100% /
/dev/root 1.4M 1.4M 0 100% /rom
/dev/mtdblock5 4.9M 3.1M 1.8M 63% /jffs
mini_fo:/jffs 1.4M 1.4M 0 100% /
/dev/sda1 113.9M 29.6M 78.4M 27% /mnt/usbdrive

root@OpenWrt:~# free
total used free shared buffers
Mem: 30412 29300 1112 0 6040
Swap: 0 0 0
Total: 30412 29300 1112


/etc/init.d/done
================
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

START=95
boot() {
[ -d /tmp/root ] && {
lock /tmp/.switch2jffs
firstboot switch2jffs
lock -u /tmp/.switch2jffs
}

# set leds to normal state
. /etc/diag.sh
set_state done
# killall httpd
/sbin/mjpg_streamer -i "input_uvc.so -r 960x720" -o "output_http.so -p 8080 -w /webcam_www"
}


upslug2 --image="/home/graham/openwrt_2011/openwrt-nslu2-squashfs.bin"
set mac to 192.168.1.190
open web page
192.168.1.1
configure network interfaces LAN add gateway and additional field DNS server
system-software
update
vsftpd
opkg list_installed
/etc/init.d/vsftpd enable
/etc/init.d/vsftpd start
ps to check
opkg update
opkg install mjpg-streamer
see /webcam_www present
opkg install kmod-video-core kmod-video-uvc kmod-usb-core kmod-usb2

root@OpenWrt:~# opkg list_installed
base-files-ixp4xx - 14-r14511 -
bridge - 1.4-1 -
busybox - 1.11.2-2 -
dnsmasq - 2.46-1 -
dropbear - 0.51-2 -
fconfig - 20080329-1 -
firewall - 1-1 -
hostapd-mini - 0.6.6-1 -
hotplug2 - 0.9+r102-2 -
i2c-tools - 3.0.1-1 -
iptables - 1.4.0-1 -
iptables-mod-conntrack - 1.4.0-1 -
iptables-mod-nat - 1.4.0-1 -
ixp4xx-microcode - 2.4-2 -
kernel - 2.6.26.6-ixp4xx-1 -
kmod-fs-ext2 - 2.6.26.6-ixp4xx-1 -
kmod-fs-ext3 - 2.6.26.6-ixp4xx-1 -
kmod-fs-vfat - 2.6.26.6-ixp4xx-1 -
kmod-ipt-conntrack - 2.6.26.6-ixp4xx-1 -
kmod-ipt-core - 2.6.26.6-ixp4xx-1 -
kmod-ipt-nat - 2.6.26.6-ixp4xx-1 -
kmod-ipt-nathelper - 2.6.26.6-ixp4xx-1 -
kmod-madwifi - 2.6.26.6+r3314-ixp4xx-2 -
kmod-nls-base - 2.6.26.6-ixp4xx-1 -
kmod-ppp - 2.6.26.6-ixp4xx-1 -
kmod-pppoe - 2.6.26.6-ixp4xx-1 -
kmod-scsi-core - 2.6.26.6-ixp4xx-1 -
kmod-usb-core - 2.6.26.6-ixp4xx-1 -
kmod-usb-storage - 2.6.26.6-ixp4xx-1 -
kmod-usb-uhci - 2.6.26.6-ixp4xx-1 -
kmod-usb2 - 2.6.26.6-ixp4xx-1 -
kmod-video-core - 2.6.26.6-ixp4xx-1 -
kmod-video-uvc - 2.6.26.6+r261-ixp4xx-1 -
libgcc - 4.1.2-14 -
libjpeg - 6b-1 -
liblua - 5.1.4-2 -
libncurses - 5.6-1 -
libpthread - 0.9.29-14 -
libuci - 0.7.3-1 -
libuci-lua - 0.7.3-1 -
lua - 5.1.4-2 -
luci-admin-core - 0.8.6-1 -
luci-admin-full - 0.8.6-1 -
luci-admin-mini - 0.8.6-1 -
luci-app-firewall - 0.8.6-1 -
luci-cbi - 0.8.6-1 -
luci-core - 0.8.6-1 -
luci-http - 0.8.6-1 -
luci-i18n-english - 0.8.6-1 -
luci-ipkg - 0.8.6-1 -
luci-sgi-cgi - 0.8.6-1 -
luci-sys - 0.8.6-1 -
luci-theme-base - 0.8.6-1 -
luci-theme-openwrt - 0.8.6-1 -
luci-uci - 0.8.6-1 -
luci-uvl - 0.8.6-1 -
luci-web - 0.8.6-1 -
mjpg-streamer - r68-2 -
mtd - 8 -
nano - 2.0.7-1 -
opkg - 4564-3 -
ppp - 2.4.3-10 -
ppp-mod-pppoe - 2.4.3-10 -
python-mini - 2.5.4-2 -
uci - 0.7.3-1 -
uclibc - 0.9.29-14 -
udevtrigger - 106-1 -
vsftpd - 2.0.6-2 -
wireless-tools - 29-2 -
zlib - 1.2.3-5 -
root@OpenWrt:~#


 

Slug 50

Original JohnArthur slug

root@Slug_50:~# ipkg list_installed
base-files-ixp4xx - 12-r10613 -
bridge - 1.0.6-1 -
busybox - 1.8.2-1 -
dnsmasq - 2.40-1 -
dropbear - 0.50-3 -
e2fsprogs - 1.39-1 -
fdisk - 2.13.0.1-1 -
hotplug2 - 0.9+r102-2 -
i2c-tools - 3.0.0-1 -
iptables - 1.3.8-2 -
ixp4xx-microcode - 2.4-1 -
kernel - 2.6.25.1-ixp4xx-1 -
kmod-fs-ext2 - 2.6.23.16-ixp4xx-1 -
kmod-fs-ext3 - 2.6.23.16-ixp4xx-1 -
kmod-fs-vfat - 2.6.25.1-ixp4xx-1 -
kmod-ipt-nathelper - 2.6.23.16-ixp4xx-1 -
kmod-nls-base - 2.6.25.1-ixp4xx-1 -
kmod-ppp - 2.6.23.16-ixp4xx-1 -
kmod-pppoe - 2.6.23.16-ixp4xx-1 -
kmod-scsi-core - 2.6.23.16-ixp4xx-1 -
kmod-usb-core - 2.6.23.16-ixp4xx-1 -
kmod-usb-ohci - 2.6.23.16-ixp4xx-1 -
kmod-usb-storage - 2.6.23.16-ixp4xx-1 -
kmod-usb2 - 2.6.23.16-ixp4xx-1 -
kmod-video-core - 2.6.23.16-ixp4xx-1 -
kmod-video-uvc - 2.6.23.16+r151-ixp4xx-1 -
libblkid - 1.39-1 -
libgcc - 4.1.2-12 -
libjpeg - 6b-1 -
libncurses - 5.6-1 -
libopenssl - 0.9.8e-3 -
libpthread - 0.9.29-12 -
libuci - 0.3.0-1 -
libuuid - 1.39-1 -
mjpg-streamer - rev51-1 -
mtd - 6 -
nano - 2.0.7-1 -
ppp - 2.4.3-9 -
ppp-mod-pppoe - 2.4.3-9 -
samba-common - 2.0.10-4 -
samba-server - 2.0.10-4 -
swap-utils - 2.13.0.1-1 -
uci - 0.3.0-1 -
uclibc - 0.9.29-12 -
udevtrigger - 106-1 -
vsftpd - 2.0.5-2 -
zlib - 1.2.3-5 -
Done. 


Slug 51
root@OpenWrt:~# lsmod
Module Size Used by Tainted: P
uvcvideo 45480 1
videodev 23392 2 uvcvideo
compat_ioctl32 384 1 uvcvideo
v4l1_compat 12100 2 uvcvideo,videodev
v4l2_common 7040 0
usb_storage 58791 1
ehci_hcd 29740 0
uhci_hcd 18252 0
ath_pci 100548 0
wlan_xauth 416 0
wlan_wep 3392 0
wlan_tkip 8224 0
wlan_ccmp 4512 0
wlan_acl 1600 0
ath_rate_minstrel 7776 0
ath_hal 263700 2 ath_pci,ath_rate_minstrel
wlan_scan_sta 5856 0
wlan_scan_ap 3840 0
wlan 132992 9 ath_pci,wlan_xauth,wlan_wep,wlan_tkip,wlan_ccmp,wlan_acl,ath_rate_minstrel,wlan_scan_sta,wlan_scan_ap
nf_nat_tftp 448 0
nf_conntrack_tftp 2408 1 nf_nat_tftp
nf_nat_irc 736 0
nf_conntrack_irc 2548 1 nf_nat_irc
nf_nat_ftp 1216 0
nf_conntrack_ftp 4544 1 nf_nat_ftp
ipt_MASQUERADE 992 1
iptable_nat 2792 1
nf_nat 8886 5 nf_nat_tftp,nf_nat_irc,nf_nat_ftp,ipt_MASQUERADE,iptable_nat
xt_state 800 6
nf_conntrack_ipv4 7308 9 iptable_nat,nf_nat
nf_conntrack 31908 11 nf_nat_tftp,nf_conntrack_tftp,nf_nat_irc,nf_conntrack_irc,nf_nat_ftp,nf_conntrack_ftp,ipt_MASQUERADE,iptable_nat,nf_nat,xt_state,nf_conntrack_ipv4
sd_mod 15344 2
ipt_REJECT 1504 2
xt_TCPMSS 2336 1
ipt_LOG 3936 0
xt_multiport 1824 0
xt_mac 672 0
xt_limit 960 1
iptable_mangle 1120 0
iptable_filter 928 1
ip_tables 7600 3 iptable_nat,iptable_mangle,iptable_filter
xt_tcpudp 1760 3
x_tables 6660 11 ipt_MASQUERADE,iptable_nat,xt_state,ipt_REJECT,xt_TCPMSS,ipt_LOG,xt_multiport,xt_mac,xt_limit,ip_tables,xt_tcpudp
ppp_async 5696 0
ppp_generic 16116 1 ppp_async
slhc 3776 1 ppp_generic
crc_ccitt 960 1 ppp_async
vfat 7136 0
fat 35388 1 vfat
ext3 84740 0
jbd 27444 1 ext3
ext2 40740 1
usbcore 84468 5 uvcvideo,usb_storage,ehci_hcd,uhci_hcd
scsi_mod 59712 2 usb_storage,sd_mod
nls_base 4096 2 vfat,fat
root@OpenWrt:~#


 

Slug 50

Original JohnArthur slug

root@Slug_50:/# lsmod
Module Size Used by Not tainted
uvcvideo 41252 1
videodev 21440 2 uvcvideo
compat_ioctl32 416 1 uvcvideo
v4l1_compat 10820 2 uvcvideo,videodev
v4l2_common 12832 2 uvcvideo,videodev
usb_storage 57575 1
ehci_hcd 25612 0
ohci_hcd 14116 0
sd_mod 15280 2
nf_nat_tftp 480 0
nf_conntrack_tftp 2440 1 nf_nat_tftp
nf_nat_irc 768 0
nf_conntrack_irc 2572 1 nf_nat_irc
nf_nat_ftp 1248 0
nf_conntrack_ftp 4544 1 nf_nat_ftp
ppp_async 6144 0
ppp_generic 17332 1 ppp_async
slhc 3872 1 ppp_generic
crc_ccitt 1024 1 ppp_async
ext3 83204 0
jbd 37224 1 ext3
ext2 35844 1
usbcore 83032 5 uvcvideo,usb_storage,ehci_hcd,ohci_hcd
scsi_mod 57160 2 usb_storage,sd_mod


Python Notes

import subprocess
subprocess.call("helloWorld")

/*
*example hello world program
*/
#include <stdio.h>
int main(int argc, char** argv)
{
/* comment */
printf("Graham says hello world \n");
return 0;
}
/*graham_hello.c */

https://dev.openwrt.org/wiki/GetSource

bBeeCam notes
https://dev.openwrt.org/wiki/GetSource
C Code used
PCF8574_addr_byteout 61 253
PCF8574_addr_read_sweex_nowrite 38

byte_as_integer = int(PCF8574_byte_input)
print int("42"), str(42) # convert from/to string
print "spam" + str(42) # force concatenation
print int("42") + 1 # force addition

PCF8574_byte_input = os.popen('PCF8574_addr_read_slug_no_clear 39').read()

=========================================================== %

print "7/3 - print the remainder after a division - mod " , (7 % 3)

Number Type Conversion:

Python converts numbers internally in an expression containing mixed types to a common type for evaluation.
Type int(x) to convert x to a plain integer. int long float
Type long(x) to convert x to a long integer.
Type float(x) to convert x to a floating-point number.

----------------------------------------------------- len lists
>>> # Measure some strings:
... a = ['cat', 'window', 'defenestrate']
>>> for x in a:
... print x, len(x)
...
cat 3
window 6
defenestrate 12
--------------------------------------------------- sleep

#!/usr/bin/python
import time
print "Start : %s" % time.ctime()
time.sleep( 5 )
print "End : %s" % time.ctime()

This produces following result:

Start : Tue Feb 17 10:19:18 2009
End : Tue Feb 17 10:19:23 2009
--------------------------------------------------- os.popen

import os
import time
os.popen('PCF8574_addr_byteout_slug 39 0')
time.sleep( 0.05 )
os.popen('PCF8574_addr_byteout_slug 39 1')
----------------------------------------------------
>>> x = int(raw_input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'
...
More
-------------------------------------------------- break
for letter in 'Python': # First Example
if letter == 'h':
break
print 'Current Letter :', letter

var = 10 # Second Example
while var > 0:
print 'Current variable value :', var
var = var -1
if var == 5:
break

print "Good bye!"
-------------------------------------------------- modules

def hiThere(a, b):
"""Optional docstring describing the function:
Arguments:
a - Name of person a
b - Name of person b
Using docstrings is 'best practice'
The help(x) command prints out the docstring for the function."""
print "Hello", a
print "Hi there", b

hiThere("Fred", "Jim")
x = 'mike'
y = 42
hiThere(x, y)

prints

Hello Fred
Hi there Jim
Hello mike
Hi there 42
-----------------------------------------------------