Up and coming changes

142 replies [Last post]
mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Beaglebone

Brett, can you let me know what you think should run so far on the BB port (as installed from the opkg install)? 

I'm trying to move stuff over from the HAH to the BB bit by bit and I'm not sure what should run and what isn't running yet. I'm not in any rush to do anything so at your pace, not mine :) If anything I'm doing this to help you test (and learn) 

I'm still working on my cross compiler and have taken my BB back to shipped state more times than I care to remember. 

If there is anything I can do to help. let me know.

Mark

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Mark,I pushed a new 0.4

Mark,

I pushed a new 0.4 release of the BB build up last night which has a lot of the bugs that have been found recently corrected.  Make sure you adjust your feed path (as per my typo I mentioned earlier)

I started integrating a jeenode and making sure the basics work that is when I found that it was all ok until I logged out and then suddenty all the programs stopped, also on reboot they don't start, even thou the /etc/init.d and associated bits looks to be setup ok.   I will look into this tonight time permitting.

I'm suprised you have had so many failures.  My bone has been rather solid I've not had to reflash yet.

I was thinking of creating a branch in the SVN repo just for the bone.  I was also considering perhaps using something like bitbake which takes care of all the x-compiler depency building and ipkg creation for you.  If done right this would also support the PI from the same branch along with other embedded platforms out of the box.  Its very early days.

Brett

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Reflashing

Don't worry Brett, the reflashing is down to me, not you.

Getting the wireless working was the first hurdle but it's all falling in to place now.

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
init script

Brett,

 

I had to add the following to the xap init script on the pi in order to get this working:

#!/bin/sh
#
# /etc/init.d/xap start [component...]
# /etc/init.d/xap stop [component...]

### BEGIN INIT INFO
# Provides:          xap
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to start a program at boot
# Description:       A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown.
### END INIT INFO

 

not sure if the bone is the same?

 

Garry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Yup this is what I posted on

Yup this is what I posted on mine.   Close enough.  You should include networking as a required start btw.  The remote_fs probably isn't so important but I like to make sure that is up too.

#!/bin/sh

### BEGIN INIT INFO
# Provides:          xap
# Required-Start:       $remote_fs $syslog $networking
# Required-Stop:        $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      1
# Short-Description: xAP HAH system
# Description:       xAP Home automation hub
### END INIT INFO
#
# /etc/init.d/xap start [component...]
# /etc/init.d/xap stop [component...]

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Thanks Brett, will update

Thanks Brett, will update mine later!

G.

brett
Offline
Providence, United States
Joined: 9 Jan 2010
What think is happening is

What think is happening is that because the IP address is obtained via DHCP.  This part of the init script is ASYNC and eth0 isn't ready before the xAP sub-system is trying to start up using it.

root@beaglebone:/var/log# more xap-hub.log
xAP HUB
Copyright (C) DBzoo, 2008-2014

[crt][init.c:113:discoverBroadcastNetwork] errno 99 (Cannot assign requested address)
[crt][init.c:113:discoverBroadcastNetwork] Unable to query capabilities of interface eth0

I am going to switch to a static IP (how it currently looks)

root@beaglebone:/var/lib/connman/ethernet_00183193c84d_cable# cat settings
[ethernet_00183193c84d_cable]
Name=Wired
Modified=2014-02-05T10:12:06.005549Z
IPv4.method=dhcp
IPv6.method=auto
IPv6.privacy=disabled
IPv4.DHCP.LastAddress=192.168.1.100

I will modify this to be STATIC anyway that will make it easier to find.
What is odd is that kloned starts up just fine its all the xap app that are failing.

http://derekmolloy.ie/set-ip-address-to-be-static-on-the-beaglebone-black/

[ethernet_00183193c84d_cable]
Name=Wired
Modified=2014-02-06T08:35:43.519891Z
IPv4.method=manual
IPv6.method=auto
IPv6.privacy=disabled
IPv4.DHCP.LastAddress=192.168.1.100
Nameservers=192.168.1.20;
IPv4.netmask_prefixlen=24
IPv4.local_address=192.168.1.100
IPv4.gateway=192.168.1.1

Nope - same issue.  WTF.    Is this some latent bug?   Digging.....

Brett

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
xAP before network ready

Maybe this will give some pointers (I'm sure you've already found it though) http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/

on another note, is there an easy (for me) way to get the hub to run on wlan0 rather than eth0?

I had a look at the link from Derek Malloy you mentioned above for getting a static ip address. It works for eth0 but connman doesn't seem to work well at giving wlan0 a static address so I have stopped connman and gone back to using an interfaces file (/etc/network/interfaces). In there I have the static settings I require.

auto lo

iface lo inet loopback

 

auto eth0

iface eth0 inet static

address 192.168.0.99

netmask 255.255.255.0

gateway 192.168.0.1

dns-nameservers 192.168.0.1

 

iface usb0 inet static

address 192.168.7.2

netmask 255.255.255.0

gateway 192.168.7.1

dns-nameservers 192.168.7.1

 

iface wlan0 inet static

address 192.168.0.98

netmask 255.255.255.0

gateway 192.168.0.1

dns-nameservers 192.168.0.1

wireless_mode managed

wireless_essid SSID_HERE

wpa-driver wext

wpa-conf /etc/wpa_supplicant.conf

pre-up wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

 

post-down killall -q wpa_supplicant

This also requires a wpa_supplicant.conf file and a .service file in /etc/systemd/system but the beauty of that is that you get notice that the network is indeed up.

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Mark,you can run hub on any

Mark,

you can run hub on any port by using the -i flag. Ie xap-hub -i wlan0

to run everything on another port automatically  you will need to amend the xap init script, this is what Brett is having issues with at the moment I believe. 

I don't understand why this is different on the beaglebone though , the pi starts up with no issues after very minimal changes to the livebox init script?

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
I wonder if the issues on the

I wonder if the issues on the BB are down to Angstrom using systemd for initialisation. While it supposedly also runs init, it seems systemd has now taken over as the default initialisation daemon and doesn't really run the init stuff properly.

probably the simplest description of what to do is here http://unix.stackexchange.com/questions/45940/setting-up-boot-scripts-for-beaglebone-angstrom

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Mark,I don't have an

Mark,

I don't have an /etc/network directory let alone an interfaces file inside it.
Are you stil on Angstrom v2012.05 ?

As an experiment I built an systemd enabled xap-hub.
Although it still does not startup correct it does however now stay alive when I log out.
So its a minor step forward.

I also played around with dependencies.  I built an xap-hub.ipk and an xaplib2.ipk when I install the hub it noticed the dependency and opkg automatically downloaded the library too.   So that's kind of neat to get working.

connman is a stinking pile of shit.  Its trying to be too smart for its own damn good.
I have one interface just bring it up FFS and stop rooting around with looking for wifi and all the other crap I don't even have.   It also screws with my /etc/resolv.conf and I can't get that sorted at all.   What a crock connman is.  A half baked steam pile.

As Gary said it just works on the PI.  That is how things should be.

I'm going to rework this code that is playing up in the xaplib2.so library.
At the same time I'm going to have it default to using the first network interface that it can find if none is supplied with (-i <nic) option.  That will help with defaulting too.

Brett

kevin
Offline
Huddersfield, United Kingdom
Joined: 17 May 2010
BeagleBone Black

A probably stupid question but what are the likely issues with running this on a BeagleBone Black (which is half the price)  ? 

K

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Brett, yes I'm still on

Brett, yes I'm still on Angstrom.

Angstrom v2012.12 (Core edition)

I had to create the interfaces file based on this write up http://octopusprotos.com/?p=37 after STOPPING connman. Better to run without it. 

Looking at that, could I not just put the xap startup in the net.service file after the network has started up?

Setting up to run with whatever interface it finds first sounds good provided it doesn't use the USB interface that is ALWAYS present.

Kevin, this is the beaglebone thread at the moment. Both Brett and myself are running on the Beaglebone Black

kevin
Offline
Huddersfield, United Kingdom
Joined: 17 May 2010
Ahh.. I misread that .. for

Ahh.. I misread that .. for some reason I thought you were both on the previous BeagleBone (original) .   I'm pretty useless Linux wise but as this matures and the updates work 'on platform' I'll jump in .   Hopefully someone will post a complete image for this and the Pi when it's stable .

Do you by any chance know if iServer is running OK on BeagleBone ?

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
KevinI'm also pretty useless

Kevin

I'm also pretty useless on linux (it doesn't help there being so many versions) but getting there thanks to the HAH and now the BB. Get yourself a BB Black and jump in.

Mark

kevin
Offline
Huddersfield, United Kingdom
Joined: 17 May 2010
Backordered

The BB site seems down currently but I'll backorder one from a UK distributor anyway...

I am just going outside and may be some time   ... it seems

K

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
BBB restock

I have several links set up for UK distributors such as RS, Farnell, CPC etc to alert me when the Black is back in stock.

Alas, nothing yet :(

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Kevin I managed to score an

Kevin I managed to score an original beaglebone for $30 USD from seeedstudio, i think they where having a runout sale on the older items and it was too good an offer to pass up.

Mark, After a bit of a rewrite, which I've committed to the SVN repo as its benefical in the wider scheme of things even to the livebox, I can clearly see that indeed the xap processes are being launched before the network interface is up.  Which ties in with that I thought was happening.

I do like to be 100% sure that I'm not going mad - now the problem is defined do you see a similar problem happen with your updated angstrom distro?   I'll proceed to update mine and see, I'll also look at disabling the connmand too.

root@beaglebone:/var/log# cat xap-hub.log
xAP HUB
Copyright (C) DBzoo, 2008-2014

[inf][init.c:98:discoverBroadcastNetwork] 1 interfaces found
[inf][init.c:102:discoverBroadcastNetwork] 1) interface: lo
[crt][init.c:127:discoverBroadcastNetwork] No interface found

I do like my changes as now nobody should need to bother with (-i) unless they have >1 nic active on their distro with different broadcast addresses.

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
For now the workaround is

For now the workaround is just to wait until the network is up and then a couple of seconds after detecting it for good measure.  By doing a network check and not a "always sleep" the script remains responsive when called on the command line or if the network is instantly up like it is on the PI (or perhaps later angstrom distro's).  Its a hack but it works.
See /etc/init.d/xap and the 'checkNetwork' function.

I've push 0.5 of the HAH distribution .ipk up with my latest changes including this hack.
Just a reminder that you can install the HAH onto your BB with like this:

# cat /etc/opkg/hah.conf
src/gz hah http://homeautomationhub.com/feeds/ipkg/eglibc/armv7a

# opkg update
# opkg install hah

Mark you will see a single location MYDEV that you need to change to wlan0 to get this wireless lan enabled.  You migh also need to hack with the checkNetwork script and wait on wlan0 if that is doing the same tricks on you.

One thing that I found useful for testing on a reboot is to set in the /etc/init.d/xap script.
MYDEV="-d 6"
When the init script runs everything is started in debug mode!
Now that the interfaces enumerate you can see what is going on and if they are there or not.

Brett

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
0.5

I've installed 0.5. Initial tests after setting MYDEV ="-i wlan0 -d 6" and changing eth0 to wlan0 in the checkNetwork

On a reboot I get no xap processes running (using htop to view)

and this in the xap-hub.log

xAP HUB

Copyright (C) DBzoo, 2008-2014

 

[inf][init.c:98:discoverBroadcastNetwork] 2 interfaces found

[inf][init.c:102:discoverBroadcastNetwork] 1) interface: lo

[inf][init.c:102:discoverBroadcastNetwork] 2) interface: usb0

[crt][init.c:126:discoverBroadcastNetwork] Interface wlan0 not found

 

After issuing ./etc/init.d/xap restart I see the xap-hub process running

605 root      20   0  1732   568   496 S  0.0  0.1  0:00.11 /usr/bin/xap-hub -i wlan0 -d 6

but none of the other processes run (they are disabled in the GUI though)

If I comment out MYDEV the I get 

505 root      20   0  1732   564   496 S  0.0  0.1  0:00.02 /usr/bin/xap-hub

so I know that I am running an up to date xap init

Now if I take replace wlan0 with eth0 in the checkNetwork I then get xap-hub in the running processes but nothing in the log (and I have no eth0 port)

So just to add to the confusion I uncomment the MYDEV and restart....

593 root      20   0  1732   568   496 S  0.0  0.1  0:00.11 /usr/bin/xap-hub -i wlan0 -d 6

bear in mind that I now have eth0 in the checkNetwork

In the xap-hub.log I now see xAP traffic

 

[inf][init.c:98:discoverBroadcastNetwork] 3 interfaces found

[inf][init.c:102:discoverBroadcastNetwork] 1) interface: lo

[inf][init.c:102:discoverBroadcastNetwork] 2) interface: usb0

[inf][init.c:102:discoverBroadcastNetwork] 3) interface: wlan0

[inf][init.c:109:discoverBroadcastNetwork] address: 192.168.0.98

[inf][init.c:114:discoverBroadcastNetwork] broadcast: 192.168.0.255

[inf][init.c:75:discoverHub] Acquired broadcast socket, port 3639

[inf][init.c:76:discoverHub] Assuming no local hub is active

[inf][hub.c:108:xapRxBroadcast] Message from client 192.168.0.9:3077

[inf][hub.c:144:xapRxBroadcast] Message originated remotely

[inf][tx.c:19:xapSend] send

xap-hbeat

{

v=12

hop=1

uid=FF00DC00

class=xap-hbeat.alive

source=dbzoo.beaglebone.hub

interval=60

port=3639

pid=192.168.0.98:593

}

 

[inf][hub.c:108:xapRxBroadcast] Message from client 192.168.0.98:40077

[inf][hub.c:116:xapRxBroadcast] Message originated locally

[inf][hub.c:108:xapRxBroadcast] Message from client 192.168.0.9:3074

[inf][hub.c:144:xapRxBroadcast] Message originated remotely

but that is after a restart, not a reboot of the BB.

After a reboot I don't see xap-hub running.

edit: I have realised now that the RESTART bypasses the checkNetwork (doh, should have read the code fully)

If I START xap after the BB has booted the xap-hub process runs but still not after a reboot.

After a START after boot I see this in the log

xAP HUB

Copyright (C) DBzoo, 2008-2014

 

[inf][init.c:98:discoverBroadcastNetwork] 3 interfaces found

[inf][init.c:102:discoverBroadcastNetwork] 1) interface: lo

[inf][init.c:102:discoverBroadcastNetwork] 2) interface: usb0

[inf][init.c:102:discoverBroadcastNetwork] 3) interface: wlan0

[inf][init.c:109:discoverBroadcastNetwork] address: 192.168.0.98

[inf][init.c:114:discoverBroadcastNetwork] broadcast: 192.168.0.255

[ntc][init.c:55:discoverHub] Broadcast socket port 3639 in use

[inf][init.c:56:discoverHub] Assuming a hub is active

[ntc][init.c:65:discoverHub] Socket port 3640 in use

[inf][init.c:67:discoverHub] Discovered port 3641

That I presume is because the process was already running. After a STOP then START all seems fine...

xAP HUB

Copyright (C) DBzoo, 2008-2014

 

[inf][init.c:98:discoverBroadcastNetwork] 3 interfaces found

[inf][init.c:102:discoverBroadcastNetwork] 1) interface: lo

[inf][init.c:102:discoverBroadcastNetwork] 2) interface: usb0

[inf][init.c:102:discoverBroadcastNetwork] 3) interface: wlan0

[inf][init.c:109:discoverBroadcastNetwork] address: 192.168.0.98

[inf][init.c:114:discoverBroadcastNetwork] broadcast: 192.168.0.255

[inf][init.c:75:discoverHub] Acquired broadcast socket, port 3639

[inf][init.c:76:discoverHub] Assuming no local hub is active

[inf][tx.c:19:xapSend] send

xap-hbeat

{

v=12

hop=1

uid=FF00DC00

class=xap-hbeat.alive

source=dbzoo.beaglebone.hub

interval=60

port=3639

pid=192.168.0.98:629

}

 

[inf][hub.c:108:xapRxBroadcast] Message from client 192.168.0.98:47568

[inf][hub.c:116:xapRxBroadcast] Message originated locally

[inf][hub.c:108:xapRxBroadcast] Message from client 192.168.0.98:56638

[inf][hub.c:116:xapRxBroadcast] Message originated locally

[inf][hub.c:108:xapRxBroadcast] Message from client 192.168.0.98:56638

[inf][hub.c:116:xapRxBroadcast] Message originated locally

[inf][hub.c:108:xapRxBroadcast] Message from client 192.168.0.98:56638

[inf][hub.c:116:xapRxBroadcast] Message originated locally

[inf][hub.c:108:xapRxBroadcast] Message from client 192.168.0.98:56638

[inf][hub.c:116:xapRxBroadcast] Message originated locally

 

[i

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Mark,I think you ended up

Mark,

I think you ended up sorting out your problems for yourself - I was a little confused at the end of reply as to whether you still had a problem or not.

The changes I made to output the interfaces definately helps debug these sorts of problem thou..  Which is good that was the intent.

You wrote -> "If I START xap after the BB has booted the xap-hub process runs but still not after a reboot."

For wlan0 you need to wait for this to startup by modifying the checkNetwork{} function so the xap startup does not get ahead of itself.  Wait for WLAN0 to be UP before allowing the xap processes to start up.

If xap-hub if it can't bind to port 3639, that is its the first xap process up, then it will fail (by design).

If you are not waiting for the network to fully start up as xap-hub is being started first, if the network is not quite ready, it will fail (as you are discovering).   However as the other processes are starting the network might become ready so you end up with things like xap-serial, plugboard later on starting but not connected into a hub so they won't be able to receive xAP packets.  (Well the 1st one as its grab port 3639 but nothing else will be able to).

Brett

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Brett,Yes the BBB is coming

Brett,

Yes the BBB is coming up reliably now. Got it running a CC node for a while to see how it goes.

Cheers for all you efforts

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Cool.I have a jeenode

 

Cool.

I have a jeenode attached to mine now so I know: xap-hub, xap-serial and plugboard are happy.

What is neat is the the livebox is caching the xAPBSC.event with xapCacheWebserverApplet.lua with simple set of filters.

local vfs = {
   filter={
      xap.Filter{["xap-header"] = {
                    source="dbzoo.livebox.Controller:1wire.*",
                    class="xAPBSC.event" }
              },
      xap.Filter{["xap-header"] = {
                    source="dbzoo.*.jeenode:>",   -- Any jeenode attached to any HOST
                    class="xAPBSC.event" }
              },
   },
   data={}
}

So I get this web page from my livebox on port 8080 (served by the LUA web server)

Cached xap-header source keys

  • dbzoo.nanode.jeenode:5.temp
  • dbzoo.nanode.jeenode:3.temp
  • dbzoo.nanode.jeenode:4.temp
  • dbzoo.nanode.jeenode:5.moved
  • dbzoo.nanode.jeenode:3.lobat
  • dbzoo.nanode.jeenode:2.light
  • dbzoo.nanode.jeenode:7.temp
  • dbzoo.nanode.jeenode:4.lobat
  • dbzoo.livebox.Controller:1wire.1
  • dbzoo.beaglebone.jeenode:1.temp
  • dbzoo.nanode.jeenode:5.lobat
  • dbzoo.nanode.jeenode:5.light
  • dbzoo.nanode.jeenode:3.light
  • dbzoo.nanode.jeenode:7.lobat
  • dbzoo.nanode.jeenode:4.light
  • dbzoo.nanode.jeenode:2.temp
  • dbzoo.nanode.jeenode:7.humi
  • dbzoo.beaglebone.jeenode:1.light
  • dbzoo.nanode.jeenode:2.lobat

Which is then polled by my CACTI logging system to produce nice graphs.  The SHED node is the beagle bone feed.  Its a large shed 6m x 9m x 3m  (w x l x h)
It getting a little warm in there today  :)

All xAP temperature sensors

The spikey comms temperature is because I have another LUA script that monitors the temperature and turns on an exhaust fan when it gets too hot in there.  So when it kicks in the temp drops rapidly and then it heats back up again.

I have downloaded the latest Angstrom distro so I will check that out too.

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Notes on how to remove connman

Want to get back a sane network startup without connman?
I have the wiki page for you.

http://www.dbzoo.com/livebox/beagleboneporting#connman_is_shit

brett
Offline
Providence, United States
Joined: 9 Jan 2010
One step back.I updated to

One step back.
I updated to the lastest angstrom distro and now I get a kernel crash when I boot up with my jeenode attached.  :(

Detaching loopback /dev/loop0.
All loop devices detached.
Detaching DM devices.
All DM devices detached.
[   98.928239] (NULL device *): gadget not registered.
[   98.948135] Power down.
[   98.954053] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
[   98.954053]
[   98.963667] [<c001051d>] (unwind_backtrace+0x1/0x8c) from [<c036c641>] (panic+0x55/0x14c)
[   98.972241] [<c036c641>] (panic+0x55/0x14c) from [<c002ec8f>] (do_exit+0x2ef/0x5dc)
[   98.980268] [<c002ec8f>] (do_exit+0x2ef/0x5dc) from [<c0036983>] (sys_reboot+0xb5/0x126)
[   98.988747] [<c0036983>] (sys_reboot+0xb5/0x126) from [<c000c641>] (ret_fast_syscall+0x1/0x46)

The good - there is a fix for this.
The other good - I installed the new distro on another micro SD card just in case I need to switch back.

https://github.com/beagleboard/kernel/issues/26

The bad - you have to build your own distro as its not released with this bug fix yet.
And on that note I'm going to back to v2012.05

Mark let me know if you run into this.  Have you attached a jeenode yet?
Brett

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Angstrom v2012.12 - Kernel 3.8.13

I have seen the system hang on REBOOT but have usually not been able to reproduce it.

Just tried now with USB Wifi dongle and jeenode attached.

At REBOOT I get 

Detaching loopback /dev/loop0.

All loop devices detached.

Detaching DM devices.

All DM devices detached.

[68396.718134] (NULL device *): gadget not registered.

[68396.740186] Restarting system.

U-Boot SPL 2013.04-dirty (Jul 10 2013 - 14:02:53)

at a shutdown I get this (but thought this was normal)

Detaching loopback /dev/loop0.

All loop devices detached.

Detaching DM devices.

All DM devi[   36.666696] (NULL device *): gadget not registered.

ces detached.

[   36.681696] Power down.

[   36.686876] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000

[   36.686876] 

brett
Offline
Providence, United States
Joined: 9 Jan 2010
A kernel panic is never

A kernel panic is never "normal" - that's what we call a bug.

UPDATE:  310.11 - As part of the BB porting work I've pushed another livebox release.
This includes a couple of changes
  * The xap-hub won't appear as dbzoo.hub.linux-x.x.x  instead it will be inline with all the others for the host.    dbzoo.'hostname'.hub
  * There is no need to add -i br0 when you start them up on the livebox, they will figure it out for themselves which interface is active and can be used.

Look mum, no -i br0 !

  142 root      1032 S    /usr/bin/xap-hub
  145 root      1080 S    /usr/bin/xap-xively
  146 root      1072 S    /usr/bin/xap-livebox -s /dev/ttyS0
  148 root      1460 S    /usr/bin/iServer
  151 root      1460 S    /usr/bin/iServer
  152 root      1460 S    /usr/bin/iServer

I think this will be my final beta before I push 311.  To put a stick in the sand.

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
xap-serial lockup on the BB

xap-serial lockup on the BB.  I attached an strace to the PID to see what was going on and its in this infinite loop driving CPU up to 100%.

gettimeofday({1392627776, 983642}, NULL) = 0
select(6, [4 5], NULL, NULL, {1, 0})    = 1 (in [5], left {0, 999969})
read(5, "", 512)                        = 0
gettimeofday({1392627776, 984893}, NULL) = 0
select(6, [4 5], NULL, NULL, {1, 0})    = 1 (in [5], left {1, 0})
read(5, "", 512)                        = 0
gettimeofday({1392627776, 985595}, NULL) = 0
select(6, [4 5], NULL, NULL, {1, 0})    = 1 (in [5], left {1, 0})
read(5, "", 512)                        = 0
gettimeofday({1392627776, 986297}, NULL) = 0
select(6, [4 5], NULL, NULL, {1, 0})    = 1 (in [5], left {0, 999969})

I'm not sure what is causing this yet but it happens after xap-serial has been running for few days.  As this does not happen on the livebox its either a BB specific bug or maybe a library issue.   Gary I take it xap-serial on the PI is solid for you?

I compiled my own BB distro last night - I just need to test it out and then post my notes.]

Replying to self:

Examining the message log I see this:

[83285.524627] ti81xx_interrupt 955: CAUTION: musb1: Babble Interrupt Occured
[83285.531829] ti81xx_interrupt 956: Please issue long reset to make usb functional !!
[83285.821716] usb 1-1: USB disconnect, device number 52
[83285.822387] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB                             1
[83285.822479] ftdi_sio 1-1:1.0: device disconnected
[83286.098419] usb 1-1: new full-speed USB device number 53 using musb-hdrc
[83286.243774] usb 1-1: New USB device found, idVendor=0403, idProduct=6001
[83286.243804] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[83286.243835] usb 1-1: Product: FT232R USB UART
[83286.243835] usb 1-1: Manufacturer: FTDI
[83286.243865] usb 1-1: SerialNumber: A600eEQf
[83286.247222] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
[83286.247406] usb 1-1: Detected FT232RL
[83286.247436] usb 1-1: Number of endpoints 2
[83286.247467] usb 1-1: Endpoint 1 MaxPacketSize 64
[83286.247467] usb 1-1: Endpoint 2 MaxPacketSize 64
[83286.247497] usb 1-1: Setting MaxPacketSize 64
[83286.247985] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB1

The USB device driver has crashed and then its reregistered the device as /dev/ttyUSB1 whilst xap-serial already has the port /dev/ttyUSB0 open.   Thus causing the code to freak out not suprising really as this shit not be happening.

I'm really starting to think this Angstrom distro is as buggy as hell.   If I upgrade I get USB bugs if I stay when I am I get USB bugs.   FFS people get it right.

It might be time to piss this off and try my own angstrom distribution built from the latest src code.  Either that or suck it up and try a Ubuntu build.  http://elinux.org/BeagleBoardUbuntu

Brett

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Ubuntu is probably the better

Ubuntu is probably the better option. 

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Hi Brett. Yeah xap-serial

Hi Brett. Yeah xap-serial really solid on pi. Run for weeks now.

Not had any real issues with any of the components now xively is fixed. 

I have had twitter die once with no error log. If this happens again I'll run in debug mode. 

 

Garry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
I have upgraded my beagle to

I have upgraded my beagle to unbuntu and have built a "portable" distribution that compiles everything up.  Just having a few issues with kloned, which I'm going to deprecate when moving from the livebox, but I'd like to get it working as a starter.

Once I get a clean build I'll check this lot in to a 'portable' branch.  This should "just compile" on the PI too.  I'm doing this all native no cross compiling this time if it works for me, it should work for you too.

Out of this "sysroot" that is built the next step is to automate the packaging.  Once this framework stuff is in place I can look at rewriting a new web UI.

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Good the hear your having

Good the hear your having more success with ubuntu.

if you need me to try anything on the pi I'm happy to put a clean SD card in and test for you.

easy enough to swap my current card back in afterwards.

 

Garry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Mark / Gary,I have some

Mark / Gary,

I have some testing for you.  You'll need to be running Ubuntu on your Bone / PI.
@Gary there is no need to swap cards as the build will not install anything its simply lays out the created files in a sysroot.   The purpose of the test is to verify the build works for you like it does for me.
@Mark I used a .img from here http://elinux.org/BeagleBoardUbuntu with my windows box to write the SD card.

How to proceed.  You don't need to be root and its best you aren't.

svn checkout http://livebox-hah.googlecode.com/svn/branches/portable
cd portable

In there you will find a README that details what additional build packages you should have installed just run the apt-get to check you have them all.

After you have installed those type "make" and sit back.  When its done all the binaries will be in build/sysroot.
On my beagle bone: 9m 30sec

This portable distribution built just as easily on my x86_64 linux machine too.
On my linux box it built in: 40sec.

This should allow folk to compile the code on whatever platform they desire, assuming you can resolve the dependencies, most distro's have those dev packages available even on my aging old Centos 5 box.

UPDATE:

I just finishing doing a raspberry PI build running pidora and it built just fine.

The intial pre-requisites are a little different from a ubuntu distro so I'll list them here:

Install subversion and friends.    

 yum install subversion libxml2-devel libcurl-devel openssl-devel

 

Install development environment tools.

yum groupinstall "Development Tools" --skip-broken

The Pidora distro has some issues with dependencies so skip the broken rpm's they aren't needed anyway.

Get the portable build

svn checkout http://livebox-hah.googlecode.com/svn/branches/portable
cd portable
make

On Derek's Raspberry PI it took: 15m 50sec

NOTE: There are not installation scripts nor startup scripts in this portable branch yet so even thou the binaries all build you won't be able to "start it up" and use it. YET.

I've added the target "bb-package" that will build a .deb file that you can install on the beaglebone running ubuntu to set the HAH system up.   IT just works !

Gary you'll need clone this a little for the PI and adjust the 'control' file for the PI architecture after that it should be good.   OR you can wait for Derek to rebuild his PI with a Ubuntu distro so I can figure this out.   Derek if you wouldn't mind rebuilding with Ubuntu instead of Pidora your PI  :)

Brett

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Ubuntu on Pi

>Derek if you wouldn't mind rebuilding with Ubuntu instead of Pidora your PI  :)

I'll have to wait 'till tomorrow when I have 'hands on' access to my Pi ... talking SWMBO thru the install would be too difficult! 

Derek

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
Testing times

Ok now I know what tonights task is :)

Feedback to follow

Using the following bone-ubuntu-13.10-2014-02-16-2gb.img on SD card. I will flash to eMMC later

getting all the packages required took a while on the BB.

Also needed subversion

"make" started at 23:29, finished at....

got as far as 

==> configuring libu with args: --prefix=/usr/local --no_docs  --compat_1X

 

==> building libu

 

then BB stopped, no heartbeat and a rather hot processor

 

Starting again with make at 23:48

 

make completed 23:56

 

make bb-package

 

rm -rf /home/ubuntu/portable/build/sysroot/DEBIAN

mkdir /home/ubuntu/portable/build/sysroot/DEBIAN

cp -r package/beaglebone/* /home/ubuntu/portable/build/sysroot/DEBIAN

cp -r package/etc /home/ubuntu/portable/build/sysroot

dpkg-deb -b /home/ubuntu/portable/build/sysroot /home/ubuntu/portable/build

dpkg-deb: error: conffile `/etc/kloned.conf' does not appear in package

 

make: *** [bb-package] Error 2

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
couple of snags

Brett,

 

Had a stab on a fresh raspian wheezy image and have the following observations.

required packages seem to be the same as the beaglebone but with the addition of subversion.

build-essential and lua5.1 already installed on raspian wheezy sep2103 image but no harm in checking anyway!.

 

initial attempt to make bb.package gave permission error, I have to use sudo for all commands:

second attempt gave error:

pi@raspberrypi ~/portable $ sudo make bb-package
rm -rf /home/pi/portable/build/sysroot/DEBIAN
mkdir /home/pi/portable/build/sysroot/DEBIAN
mkdir: cannot create directory `/home/pi/portable/build/sysroot/DEBIAN': No such file or directory
make: *** [bb-package] Error 1

 

 

This was due to no sysroot folder being present. Added sysroot folder and then got the following error:

pi@raspberrypi ~/portable $ sudo make bb-package
rm -rf /home/pi/portable/build/sysroot/DEBIAN
mkdir /home/pi/portable/build/sysroot/DEBIAN
cp -r package/beaglebone/* /home/pi/portable/build/sysroot/DEBIAN
cp -r package/etc /home/pi/portable/build/sysroot
dpkg-deb -b /home/pi/portable/build/sysroot /home/pi/portable/build
dpkg-deb: error: conffile `/etc/kloned.conf' does not appear in package
make: *** [bb-package] Error 2

 

Due to no Kloned.conf in package. Added /etc/kloned.conf into package and tried again.

Package created OK.

Install appeared to go ok. but no /usr/bin/xap-xxxxxx files found on system.

Am i supposed to do a sudo make aswell ?

 

EDIT: I do need to do sudo make also!

tried: sudo make

then sudo make bb-package

then sudo dpkg -i build/*.deb

reboot and all is good! (well twitter needs authorising and ini filed need eneable=1 but thats for the individual to setup)

 

STERLING WORK BRETT!

 

a few more notes for PI users:

I have found that the USB port changes its assignment randomly on reboots which plays havok if you have HAHnode and currentcost running. I added a symlink so that I can just use /dev/jeenode and /dev/currentcost instead of USB0 and USB1.

See here for info on how to do this http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/

Also, if you plan to add the HAH hardware to the serial on the GPIO pins then you need to disable login on this port. See here: http://www.hobbytronics.co.uk/raspberry-pi-serial-port

on this note, Brett can we add the serial port to be used into the xap-livebox.ini rather than in the /etc/init.d/xap file as this will need changing on different platforms. PI GPIO ports are /dev/ttyAMA0

 

Garry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Gary you said,tried: sudo

Gary you said,

tried: sudo make
then sudo make bb-package
then sudo dpkg -i build/*.deb

The correct steps are:

make
make bb-package
sudo dpkg -i build/*.deb

Only the installation needs to be done as root everything you can do as a normal user.

Yes there is quite a bit more work to be done this was an ALPHA release of the portable branch and I've yet to set many of the binaries up and verify their behaviour.   Gary you are on the leading edge of development here so expect some issues having said that it did seem to go relatively smoothly for you. Intereresting that you did not require any modification to the bb-package target for installation on the PI.   That's good to know I will adjust the directory layout then to be a little more architecture agnostic.  If you shutdown the apache server on port 80 kloned should just work too.  Or you can adjust kloned's port in the /etc/kloned.conf file to something else.

Anway this looks to be progress.. Thx for testing.

UPDATE:
To get yourself back to a clean environment you will need to clean as root as the output has already been created as the root user.
sudo make clean
After that you should be able to "make" and "make clean" as a normal user, I try not to be root more than I need to be.

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Mark,That error about

Mark,

That error about kloned.conf missing in etc was the same as Gary I just checked on a fresh build and its there for me.
Can you look in build/sysroot/etc and see if its there?
The Makefile definately installs it after klone has built.

NOTE: I just checked in some changes which you might want to grab.  "svn update"
Added the ability to override the serial port like Gary asked for.  I also added you're private emails onto my HAH commit alias so that as I make changes to the source you will get an emails too. (hope that's ok).

My commit log from the change I just commited.
[livebox]
enable=(1|0)
port=<serialport>

Updated the init.d/xap to check it xap-livebox should be started or not.
We pick up the serial port from the .ini file and default to /dev/ttyS0 if 
its not present.  This allows you to move this hardware around.

Brett

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
quick update

A quick update before heading to work..

build/sysroot/etc contains init.d  plugboard  xap.d

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Mark that would imply the

Mark that would imply the klone build failed and you did not notice.
Check for build/sysroot/usr/bin/kloned  is that there?

You could try rebuilding klone and checking for failures before just creating the package.
# make klone

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Kloned.conf

 

Brett, 

I don't understand the .deb file packing at all well yet but due to the conffiles file showing the following:

 

 
1
2
3
4
5
6
 
 
/etc/xap.d/plugboard.ini
/etc/xap.d/xap-livebox.ini
/etc/xap.d/xap-serial.ini
/etc/xap.d/iserver.ini
/etc/xap.d/xap-currentcost.ini
/etc/kloned.conf
 

I assumed there needed to be Kloned.conf in /package/etc folder.

i put one in here and the error went away. Did I not need to?

I never looked in /sysroot/etc.

Garry

EDIT: I've looked a bit more and can see my issues were due to not doing make prior to packaging. 

Probably just a coincidence then that Mark had the same error?!

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
retry

Brett,

I'll start again from scratch tonight and make sure I note any failures. As i posted earlier, the first attempt at make resulted (after 15mins or so) in no heartbeat and a HOT processor, so the failure may have occured then

Mark

mark_baldwin
Offline
Blackburn, United Kingdom
Joined: 19 May 2012
retry result

Brett

Ran the whole install again. Had issues when I used 

apt-get install build-essential libxml2-dev libcurl4-openssl-dev flex

with one of the required files. So I tried again one at a time.

No issues this time. 

I didn't keep a log but will now go through the same process and capture the error.

Kloned did not report an error and as far as I can see all is now running fine.

Well done Brett

 

edit: starting again now with logging....


brett
Offline
Providence, United States
Joined: 9 Jan 2010
I just finished a big

I just finished a big overhaul of the branches/portable makefile system.
All the dependencies resolve correctly now so to build a .deb file you only need to do "make arm-deb" and sit back and wait.  For those that want to try this on other distro's or just want direct installation it can support that too.
"make" without any arguments will give you targets you can execute.

Sadly this is a lot of busy work and at the end of it you don't see any new features for your effort, but it does set the branch up for easier building and installation.  With that out of the way I can think about what do with klone.

I'm really in two minds about this.  As much as I would like to rewrite it there is so much time already invested in klone that perhaps just a restructure might be in order instead of a flat out rewrite, this way I can preserve much of the effort already expended.  I'm leaning more in this direction the more I research "WHAT" I would use instead !
Even things like webby, which is tiny, is still 800k and that is just for framework, compared to kloned fully functional as you see it on the livebox at 300k.  Yup kloned is seriously small for what it does.

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Thanks for your efforts again

Thanks for your efforts again on this Brett. You are right in that all the work added no features but it will open up HAH to bigger audiences. Got to be a good thing!

As for Klone, I agree it does the job. My only gripe was I couldn't easily modify it. I wanted a simple customisable page for the wife to switch on/off heating, water, change temps etc. 

with corona, this is doable but a simple web page would be preferable to her. Not an app.

With the switch to pi and more access / resources this can be achieve by installing apache as well as Klone. A simple php web page can now achieve the simple control screen she wanted. (No apps required)

therefore, coming back to the point, maybe keep Kloned for  the web setup aspect of HAH, users can always put together they're own pages for other stuff if required. Maybe a few php / hah integration examples would be good. I'm still playing with this in the background, but can post my efforts if it's of use and interest 

 

Garry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
I see there are two separate

I see there are two separate problems here.

1) The ability to create a simple web page(s) that allow the same sort of flexability that the joggler does but with browser
2) A bespoke web gui to controlling HAH core components.

My initial thinking was to make 2) more flexible so that 1) could be done it in too.  Having said that the joggler GUI can be loaded in a web browser too don't forget after all it is just FLASH so you can build your buttons there.

I think for now I will just rip out and reorg klone to make more sense outside of the livebox context, this is a quicker job than rewriting.

One possability is to write a custom webserver in LUA - I mean its not that hard to be honest and then its portable and should be well suited to run back on the livebox too also it would be easy for others to add custom pages to it if its done right. Of all the directions this one I'm leaning to more.

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
Sounds good. I'll take your

Sounds good. I'll take your word on the webpage scripting in LUA. I'm sure it is simple once an example is available and it keeps the learning of new languages to a minimum.

sounds like a plan. 

one other thing I have noticed on the portable build. We are missing the init.d/controlpcb script that sends the "+++" initialisation command.

Garry

P.s. Flash is great if your not stuck with apple equipment! :(

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Yes the controlpcb script.  

Yes the controlpcb script.   The fact that you have the livebox hardware hanging off of the PI is a bit of an anomly its not something that I would invistage as "the norm" once we move away from the livebox hardware.

I would like to rip that out and have this hardware ethernet enable and simple be an xAP compliance device on your network.  In my perfect world nothing would be tethered and everything is just an xAP device on your net somewhere.
Which is why the way in which the klone web server presents itself needs to be modified.

The only reason the livebox sent a +++ was because when it was connected to /dev/ttyS0 all the boot up information also got pumped out that port on startup and so to prevent the hardware from accidently triggering a firmware command I had to have it wait until I was ready for to enter normal operating mode.

As the PI does not send it startup sequence out the serial port the whole reason for waiting for +++ in the firmware is gone.  So really the correct solution for you is instead of adding a "controlpcb" init script would be to update the firmware to not have this wait loop on +++ in the first place !

For you as a temporary HACK I would simply modify the /etc/init.xap script like this.

start_livebox() {
    INI="/etc/xap.d/xap-livebox.ini"
    if [ `iniget $INI livebox enable 0` -eq 1 ] ;  then
        PORT=`initget $INI livebox port`
        echo +++ >$PORT
        /usr/bin/xap-livebox -s $PORT $MYDEV >/var/log/xap-livebox.log 2>&1 &
    fi
}

The jury is still out on where we want this livebox hardware on a pi/beaglebone in the first place.  I know I gave Derek a mission to update the hardware to make it ethernet enabled enabling me to rewrite the firmware.

Which then opens up another whole philisophical design question.  For externally added hardware like this should the bespoke webserver have some sort of "plugin" model whereby a new web page can enabled if you have the hardware, if you don't then you won't bother seeing the Control web page for it in the first place.   I guess its a little like currentcost, xively etc. et.   the "xap-livebox" should be pushed down into that model.   Enable/Disable and if you do well here is the config and control page for it.   That is part of the "rework" for klone.   Which leaves the question.  "What is the default home page of the HAH going to show you?"  at the moment is showing you the livebox hardware status.

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
AS part of my "the hah

AS part of my "the hah hardware should not be directly on your PI/Beagle" philosophy.
I've already built and tested as standalone xAP compliance ethernet tethered devices/sketches.

The other functions on the PCB are

  • 1wire, well the jeenodes can do that, and if you really want you can put one your HAHCentral.
  • I2C/PPE -  nobody is using it even thou it very cool.
  • An LCD display -  I could built an xAP compliance LCD display for remote use.  Would be neat.
  • 4x Inputs - can build a jeenode for that if you wish.

So you see everything that the HAH hardware does can already be replaced.  Thus its not needed as a single unit.

Brett

garrydwilms
Offline
United Kingdom
Joined: 31 Mar 2011
I tend to agree Brett and

I tend to agree Brett and have started moving things like my heating control relays and 1wire off on to jeenodes. 

I still use the hardware for rf and inputs but they could easily be moved to other nodes. 

I guess as the coding is there and people like myself are using the hardware, is the best plan to keep some compatability with the hardware but move it down the pecking order?. Pretty much as you were suggesting.

if folk have the hardware and the pi/beaglebone support it then the switch is relatively painless (read cheap!). 

Longer term I will phase it out as it would allow my install to be neater if nothing else.

nice to see we have a longer term project here and the HAh is already looking like a different animal.

cheers.

 

garry

Hardware Info